www.webdeveloper.com
Results 1 to 4 of 4

Thread: Multiple form fields to clipboard?

  1. #1
    Join Date
    Jun 2010
    Posts
    4

    Exclamation Multiple form fields to clipboard?

    Hey I am trying to create a form with multiple fields, and instead of mailing it, I want it to save to clipboard. The only thing I have now is things others tried.
    Any ideas???

    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <script>
    function el(tid) {return document.getElementById(tid);}

    function copyit(){
    var b = [];
    b.push(el("t1").value);
    b.push(el("t2").value);
    b.push(el("t3").value);
    b.push(el("t4").value);
    var buffer = b.join(';');
    CB(buffer);

    document.execCommand("Copy")
    copiedtext=window.clipboardData.getData("Text");
    }
    </script>
    </head>
    <body>
    <input type="text" name="a1" value="" id="t1" />
    <input type="text" name="a2" value="" id="t2" />
    <input type="text" name="a3" value="" id="t3" />
    <input type="text" name="a4" value="" id="t4" />
    <BUTTON onClick="copyit();">Click here to Copy the contents </BUTTON>
    </body>

  2. #2
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Only works in IE. All other browsers block copying to the clipboard
    Code:
    copiedtext=window.clipboardData.setData("Text", buffer);
    You could try this Flash method: http://code.google.com/p/zeroclipboard/
    Last edited by Fang; 06-24-2010 at 10:56 AM.

  3. #3
    Join Date
    Jun 2010
    Posts
    4
    I am going to be using this as a formatting form. It will have questions and several fields. Instead of it emailing I want it to copy to the clipboard.

    I added this to the codes and it is still not working. I am lost. . .

  4. #4
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    What is the full code you are using?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles