The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Code to copy text to clip board

Go down

Code to copy text to clip board

Post by Sir. Mayo on July 25th 2013, 9:23 pm

Hi,

I'm looking for a code that copies text to the users clip board when the button is pressed.

SO i want a button that when pressed its Copies a Email address to the users clip board. Any on know how to do this???
avatar
Sir. Mayo
Forumember

Male Posts : 979
Reputation : 90
Language : English, Some french.
Location : you can also reach me on snoonet's irc server. I idle in #Techsupport Username is Vault108

http://sir-mayo.forumotion.com/

Back to top Go down

Re: Code to copy text to clip board

Post by Mr.EasyBB on July 26th 2013, 5:00 am

Sir Mayo, with Google Chrome and Firefox this is not allowed, only with Internet Explorer is this allowed with code.

A code would look like:

Code:
  function select_all(obj) {
        var text_val=eval(obj);
        text_val.focus();
        text_val.select();
        if (!document.all) return; // IE only
        r = text_val.createTextRange();
        r.execCommand('copy');
    }

Then on the button you do

<input value="http://www.sajithmr.com" onclick="select_all(this)" name="url" type="text" />

Mr.EasyBB
Forumember

Posts : 71
Reputation : 9
Language : HTML/CSS/JS/JQUERY/MOOTOOLS

http://www.avacweb.com

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum