On click image copy Text

Discussion in 'Programming' started by dollarearner, Jun 30, 2013.

  1. #1
    Hello,

    I am looking for HTML/Javascript code to copy the smiley code on clicking the smiley image. Below is the code i got from some website but it is not working properly, seems like something is missing(javascript i think so).

    Here is the code i have now

    
    <body>
    <tr> 
    <td> 
    <img src="http://www.freesmileys.org/smileys/smiley-gen054.gif" onclick="ClipBoard(this);" alt="" /> 
    //30 
    </td> 
    <td> 
    <img src="http://www.freesmileys.org/smileys/smiley-gen041.gif" onclick="ClipBoard(this);" alt="" /> 
    //87 
    </td> 
    <td> 
    <img src="http://www.freesmileys.org/smileys/smiley-gen031.gif" onclick="ClipBoard(this);" alt="" /> 
    //44
    </td> 
    </tr>
    </body>
    
    Code (markup):
    In the above code, on clicking the smileys i want the codes like '//87' to be copied into the clipboard instead of displaying it in the webpage.

    Thanks in advance.
     
    dollarearner, Jun 30, 2013 IP
  2. aidanriley629

    aidanriley629 Banned

    Messages:
    429
    Likes Received:
    23
    Best Answers:
    3
    Trophy Points:
    175
    #2
    Do you have a ton of smileys that you need to do this for orjust these 3?
     
    aidanriley629, Jul 1, 2013 IP
  3. pro2sell

    pro2sell Active Member

    Messages:
    35
    Likes Received:
    0
    Best Answers:
    2
    Trophy Points:
    58
    #3
    <img name="">
    Description
    The name attribute allows you to name an image so that it can be accessed by scripts.
    Code
    <img name="ImageName"></img>
     
    pro2sell, Jul 12, 2013 IP
  4. Code Developer

    Code Developer Active Member

    Messages:
    48
    Likes Received:
    2
    Best Answers:
    2
    Trophy Points:
    58
    #4
    You can do that with any of those ways:
    http://www.steamdev.com/zclip/
    http://bowser.effectgames.com/~jhuckaby/zeroclipboard/
     
    Code Developer, Jul 13, 2013 IP