Hi Everyone,
I have a text box, with an address which visitors need to copy into another application. I have the text box, this has the text inside. All I need now is a button that says 'copy' and when you click it, wola! However, the real world hasnt worked this way for me .
The code I have is;
<script type="text/javascript">
function ClipBoard()
{
if (window.clipboardData) {
alert("copied");
window.clipboardData.setData("Text",document.form1.name.value);
}
}
</script>
<form name="form1" method="post" action="">
<input name="name" type="text" class="inputtext" onclick="highlight(this)" id="name" value="<?php echo "$contents";?>">
<BUTTON onclick="ClipBoard()">Copy</BUTTON>
</form>
I dont understand why this wont work...
Any help would be greatly apreciated.
Thanks.