Copy ASP variable to clipboard using Javascript

Z

zakhirn

Hello,

I have a search function that is reading companies from a database via
ASP and spitting out the results. I have various fields of each company
in variables and I want to be able to create a link that uses
Javascript to copy the address to the clipboard.

I know there is the javascript:window.clipboardData.getData(), but I
can't get to parse the ASP variable through. Does anyone know how I can
do this.

Thanks in advance.
 
M

McKirahan

Hello,

I have a search function that is reading companies from a database via
ASP and spitting out the results. I have various fields of each company
in variables and I want to be able to create a link that uses
Javascript to copy the address to the clipboard.

I know there is the javascript:window.clipboardData.getData(), but I
can't get to parse the ASP variable through. Does anyone know how I can
do this.

To copy "to the clipboard" use "setData()" not "getData()".

Will this help?


<html>
<head>
<title>Clipper.asp</title>
<script type="text/javascript">
function clipper() {
var data = document.getElementById("Data").value;
alert("Clipboard = \n\n" + data);
window.clipboardData.setData("Text", data);
}
</script>
</head>
<body>
<span id="Data" value="<%=Now%>"></span>
To place the current date and time in the clipboard
<a href="javascript:clipper()">click here</a>.
</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top