Copy Selection To Clipboard

[Total: 0    Average: 0/5]

Want to have text on the page selected and put into your clipboard?

Head Code:

<SCRIPT language=Javascript>
<!--
var copytoclip=1
function HighlightAll(theField) {
var tempval=eval("document."+theField)
tempval.focus()
tempval.select()
if (document.all&&copytoclip==1){
therange=tempval.createTextRange()
therange.execCommand("Copy")
window.status="Contents highlighted and copied to clipboard!"
setTimeout("window.status=''",2400);
}
}
-->
</SCRIPT>

Body Code:

<FORM name=form1>
  <A class=high href="javascript:HighlightAll('form1.select')"> <font size="3" face="Geneva, Arial, Helvetica, san-serif"> 
  <b><font size="2">Select and Copy </font></b></font></A> <b><font face="Geneva, Arial, Helvetica, san-serif" size="1">(Click 
  to select contents and copy them to the clipboard)</font></b> <br>
  <TEXTAREA name=select cols=40 rows="6">Hello my name is Fred
and this is a test 🙂
</TEXTAREA>
</FORM>

Times Viewed: 11

Leave a Reply

Your email address will not be published. Required fields are marked *