Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Mar 2005
    Posts
    30
    Thanks
    2
    Thanked 0 Times in 0 Posts

    document.execCommand("Copy") - can it copy a passed variable?

    I've tried a bunch of different variants but all of the posts on the web are for copying information from HTML forms. I want to copy something to the clipboard that I pass off of a hyperlink.
    Code:
    function copyToClipboard(x) {   
    	if (x) 
                 {
                 alert(x);
    	x.document.execCommand("Copy");
                 }
    }
    Very rudimentary I know but when I click my hyperlink, "x" alerts fine. the message box holds the data i want it to. Now I just need help getting it copied to the clipboard. Is there any way I can just pass my varaible "x" to document.execCommand("Copy") ? If so, please elaborate.

  • #2
    New Coder
    Join Date
    Mar 2005
    Posts
    30
    Thanks
    2
    Thanked 0 Times in 0 Posts
    bump.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •