I want to add a javascript function to copy a specific text to the clipboard. I found this code:
<script language="javascript">
function toClipboard(){
var text="http://www.FindYourDesire/findyourdesire/profile.php?u n=Neo";
var copyText=text.createTextRange();
return confirm("Do you want to copy the link
http://www.FindYourDesire/findyourd...file.php?un=Neo to your clipboard?
(this only works for M$IE");
copyText.execCommand("Copy");
alert("If using M$IE, then you have just copied the link,
http://www.FindYourDesire/findyourd...file.php?un=Neo to your clipboard.");
}
</script>
and changed it a little to what I need:
<script language="javascript">
function toClipboard(text){
var copyText=text.createTextRange();
copyText.execCommand("Copy");
}
</script>
Unfortunately, this doesn't work (the bold line raises the following error:
---------------------------
Error
---------------------------
A Runtime Error has occurred.
Do you wish to Debug?
Line: 3000
Error: Object doesn't support this property or method
---------------------------
Yes No
---------------------------
Can anyone give me a hint?