Do You Know How to do this . . . ?

Discussion in 'JavaScript' started by Masterful, Apr 16, 2009.

  1. #1
    Does anyone know how to create a link which, when clicked, copies the anchor text to the user's clipboard and opens the destination in a new window?

    For example, picture this link:

    <a href="webform.com">ID: 12345</a>
    Code (markup):
    It will look like this on the page:

    ID: 12345

    When someone clicks the link, ID: 12345 must be copied to the user's clipboard and webform.com must be opened in a new window.

    Anyone know how to do this?
     
    Masterful, Apr 16, 2009 IP
  2. koko5

    koko5 Active Member

    Messages:
    394
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    70
    #2
    Hi,

    I guess you'll find this link useful.

    pp: Myabe it's better to store value in cookie instead of copy to clipboard
    Regards.
     
    koko5, Apr 17, 2009 IP
    Masterful likes this.
  3. Masterful

    Masterful Well-Known Member

    Messages:
    1,653
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    140
    #3
    Thanks, Koko5, but that only works with IE. Plus, it doesn't copy the anchor text.
     
    Masterful, Apr 17, 2009 IP
  4. JavaScriptBank.com

    JavaScriptBank.com Peon

    Messages:
    141
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    JavaScriptBank.com, Apr 17, 2009 IP
    Masterful likes this.
  5. Masterful

    Masterful Well-Known Member

    Messages:
    1,653
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    140
    #5
    Thanks, guys, but those won't work. The text to be copied must be the anchor text of the link, and when the link is clicked, the destination must be opened in a new window. For an example, click here and refer to the coupon code links.

    Even so, thanks for trying. One rep point for each of you. :)

    Can anyone else help?
     
    Masterful, Apr 17, 2009 IP
  6. Masterful

    Masterful Well-Known Member

    Messages:
    1,653
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    140
    #6
    Does anybody know how to do this? I have asked in two other forums and nobody has responded.

    Is it very difficult or something?
     
    Masterful, Apr 19, 2009 IP