accessing document object model (DOM) using vb and asp.net

  • Thread starter Thread starter Randall Arnold
  • Start date Start date
I'll use javascript for this in one of my webapps.

Here's the code:

<script language="JavaScript" type="text/JavaScript">
function ctcb(src) {
eval(src +".style.display='block'");
document.selection.clear;
txt = eval(src +".innerText");
theObj = document.all(txt);
txtRange = document.body.createTextRange();
txtRange.moveToElementText(eval(src));
txtRange.select();
txtRange.execCommand("Copy");
eval(src +".style.display='none'");
alert('Data copied to clipboard!');
}
</script>

'Put the table between PRE tags
<pre id="toClipBoard" style="display:none">
<table>
<tr>
<td>Testing</td>
<td>Clipboard</td>
</tr>
</table>
</pre>

'Execute the copy
<a href="javascript:ctcb('toClipBoard')">Click to Copy</a>

You don't have to hide/show the table, i'll do this because it has a
different layout.
 
Back
Top