Need to copy element ID to Clipboard

M

Mel

How can i copy The element ID to the Clipboard when the item is left
button clicked ?

thanks for your help
 
E

Evertjan.

Mel wrote on 21 apr 2007 in comp.lang.javascript:
How can i copy The element ID to the Clipboard when the item is left
button clicked ?

IE only:

<script type='text/javascript'>
function copyId(x){
var saver = document.getElementById('saver')
saver.value=x.id
var objectje = saver.createTextRange();
objectje.execCommand("Copy");
}
</script>

<div id='abc'
onclick = 'copyId(this)'>
click<br>here
</div>


<textarea id='saver' style='display:none;'>
</textarea>
 
P

Peter Michaux

How can i copy The element ID to the Clipboard when the item is left
button clicked ?

thanks for your help

IE has functions to do this quickly looking in google

<URL: http://www.codeproject.com/jscript/CopyasHTML.asp>

You can also do this in other browsers if they have flash.

http://ajaxian.com/archives/auto-copy-to-clipboard

This above example doesn't work like you want but if you use the same
swf file that makes it work and dynamically write the embed element
into the page then you can copy to the clipboard whenever you want.

Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top