I've been trying to figure out how to make a table header cell or table data cell highlight in order to copy it to a client's clipboard (assuming they use msie 4+).. It's similar to this form element highlight script at dynamic drive:
But instead of just copying a form element, I need it to copy an entire <th></th> or <td></td> area instead.. I've been fiddling around with "document.tablename.tdname.selection", but I'm not skilled enough with JavaScript to figure it out.. I want clients who view my PHP source code to be able to have a simple means of copying it.. Is this possible? If so, how would I go about it? Any help or pointers would be appreciated..
Here's the code from the URL above:
TIA
Take care.. peace..
eriol
But instead of just copying a form element, I need it to copy an entire <th></th> or <td></td> area instead.. I've been fiddling around with "document.tablename.tdname.selection", but I'm not skilled enough with JavaScript to figure it out.. I want clients who view my PHP source code to be able to have a simple means of copying it.. Is this possible? If so, how would I go about it? Any help or pointers would be appreciated..
Here's the code from the URL above:
Code:
<script language="Javascript">
<!--
var copytoclip=1
function HighlightAll(theField){
var tempval=eval("document."+theField)
tempval.focus()
tempval.select()
if (document.all&©toclip==1){
therange=tempval.createTextRange()
therange.execCommand("Copy")
window.status="Contents highlighted and copied"
setTimeout("window.status=''",1800)
}
}
//-->
</script>
<form name="test">
<a href="javascript:HighlightAll('test.select1')">Select All</a>
<br>
<textarea name="select1" rows=10 cols=35 >
This is some text. This is some text.
This is some text. This is some text.
</textarea>
</form>
TIA
Take care.. peace..
eriol