Perad Posted April 21, 2009 Share Posted April 21, 2009 Hi there, Could someone help me with a copy button? This is my html. <table border="1" cellSpacing="2" cellPadding="1" width="341" align="center" height="64"> <tbody> <tr> <td height="54" width="151"> <img border="0" src="http://gotyou.co.uk/wp-content/uploads/2009/04/copy-button.jpg" onclick="copyit()" width="112" height="32"> </td> <td height="50" width="100%"> <textarea id="copy" style="width:450px; height:70px; font-size:10px; overflow:hidden;"><embed src='http://gotyou.co.uk/wp-content/plugins/wordtube/player.swf' height='300' width='300' allowscriptaccess='always' allowfullscreen='true' flashvars='volume=80&bufferlength=5&displayclick=none&controlbar=none&linktarget=_self&autostart=true&title=leeds-0036.jpg&file=http%3A%2F%2Fwww.gotyou.co.uk%2Fwp-content%2Fgallery%2FNurses%2FAbb_0056.JPG&plugins=viral'/></textarea> </td> </tr> </tbody> </table> What should happen is when you click an image, it copies the code from the textarea to the users clipboard so they can paste it where every they want it. Is this possible? How do you do it? I haven't got very far. So far I have gathered the textarea id. function copyit() { var element = document.getElementById('copy')); } Link to comment https://forums.phpfreaks.com/topic/155005-copy-button/ Share on other sites More sharing options...
Axeia Posted April 21, 2009 Share Posted April 21, 2009 If you want this work reliably crossbrowser you're out of luck, javascript should not be allowed access to the clipboard for obvious reasons (people copying banknumbers, passwords and what not). However, Internet explorer seems to it though, explained over here: http://www.htmlgoodies.com/beyond/javascript/article.php/3458851 If you simply want to store data for a moment I suggest making use of a variable instead. Link to comment https://forums.phpfreaks.com/topic/155005-copy-button/#findComment-815510 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.