SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member 3.14's Avatar
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Is there a way...

    I have a php script which generates a code which is passed into a variable.

    From this, can I create a button/hyperlink to automatically select the outputted code and copy it to clipboard? Or just select it when the button is pressed. I know it's lazy since all you have to do is select the damn thing, but this ensures no possible error due to not selecting the entire code.

    Any ideas???

  2. #2
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not so much a PHP question, more Javascript

    Just print the (php) variable value inside a js function, and then use execCommand to copy to clipboard (IE only, I think )

  3. #3
    ********* Wizard silver trophy Cam's Avatar
    Join Date
    Aug 2002
    Location
    Burpengary, Australia
    Posts
    4,495
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)

  4. #4
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Mozilla 1.4
    Error: holdtext is not defined
    Source File: http://www.htmlgoodies.com/beyond/clipboard.html
    Line: 389
    Just to remind you; "...available only in IE 4.0 or better"
    I.e. good idea to add some code that checks browser version

  5. #5
    ********* Wizard silver trophy Cam's Avatar
    Join Date
    Aug 2002
    Location
    Burpengary, Australia
    Posts
    4,495
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    OK, so maybe it's a not-so-decent tutorial


Bookmarks

Posting Permissions

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