views:

95

answers:

3

hey, i know there's lots of tutorials out there but none seem to be working for me.

I have this :

<textarea name="forum_link" type="text" style="width:630px; height:90px;">
[URL=http://www.site.net/video/&lt;?=$_GET['id']?&gt;/&lt;?=$_GET['tag']?&gt;]&lt;?=$video-&gt;title?&gt;[/URL]

[URL=http://www.site.net/video/&lt;?=$_GET['id']?&gt;/&lt;?=$_GET['tag']?&gt;][IMG]&lt;?=$video-&gt;thumbnailURL?&gt;[/IMG][/URL]
</textarea>

Now all i want is a simple button, that when clicked copies the text in the textarea to the users clipboard.

Any help would be great :)

Thanks

A: 

Check out this page. It doesn't say anything about browser compatibility, but could be worth checking out! It gives a javascript copy to clipboard example, and the HTML associated with it.

http://www.geekpedia.com/tutorial126_Clipboard-cut-copy-and-paste-with-JavaScript.html

Alex
The comments suggest this is IE only.
David Dorward
Good catch, I didn't read the comments at the bottom.
Alex
+1  A: 

Sadly there's no all in one solution for this. Browsers other than IE doesnt allow copying to clipboard. I found I nice solution recently which uses Flash (for all browsers but IE) and JavaScript for IE to copy text to the clipboard. See zeroclipboard for details.

halfdan
A: 

Browser compatibility using any script is shoddy at best. JavaScript intentionally doesn't natively allow this level of functionality with the operating system. It is possible to create a signed script that you'll have better luck with, but... that's a lot more work and hardly worth it. Most people know how to copy and paste...

md5sum