Fluoresce Posted April 16, 2009 Share Posted April 16, 2009 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? I also want a hover pop-up message to appear, saying something like: "Click to copy and visit site". For example, picture this link: <a href="webform.com">ID: 12345</a> It will look like this on the page: ID: 12345 When someone hovers over it, a message will appear next to it. For example: ID: 12345 Click to copy your ID and open the Web form Then, when the user clicks the link, ID: 12345 is copied to his/her clipboard and webform.com is opened in a new window. I've seen this done before but I can't remember where. Anyone know how? Quote Link to comment Share on other sites More sharing options...
Fluoresce Posted April 17, 2009 Author Share Posted April 17, 2009 There are examples of what I want on http://www.CouponCabin.com. Hover over the coupon codes and a pop-up message will appear. Then, if you click on a coupon code, the code will be copied to your clipboard and the site will be opened in a new window. Anyone know how to do this? Quote Link to comment Share on other sites More sharing options...
Adam Posted April 17, 2009 Share Posted April 17, 2009 Not tested but you could try this, or something similar.. In the head: <script type="text/javascript"> function copyID(obj) { var id = obj.innerHTML; id.execCommand('Copy'); return true; } </script> ... and in the body: <a href="webform.com" onclick="copyID(this);">ID: 12345</a> As I said not tested! Adam! Quote Link to comment Share on other sites More sharing options...
Adam Posted April 17, 2009 Share Posted April 17, 2009 Sorry I've just tested it and it doesn't work. Says execCommand isn't a function ??? Quote Link to comment Share on other sites More sharing options...
Fluoresce Posted April 17, 2009 Author Share Posted April 17, 2009 Sorry I've just tested it and it doesn't work. Says execCommand isn't a function ??? Thanks for the attempt, MrAdam. Anyone else? Quote Link to comment Share on other sites More sharing options...
gffg4574fghsDSGDGKJYM Posted April 17, 2009 Share Posted April 17, 2009 There are examples of what I want on http://www.CouponCabin.com. Hover over the coupon codes and a pop-up message will appear. Then, if you click on a coupon code, the code will be copied to your clipboard and the site will be opened in a new window. Anyone know how to do this? Why you don't look at couponcabin.com javascript to see how they done it ? Quote Link to comment Share on other sites More sharing options...
Fluoresce Posted April 17, 2009 Author Share Posted April 17, 2009 Why you don't look at couponcabin.com javascript to see how they done it ? I'm afraid I can't read Javascript properly yet. I'm still learning, you see. Does anyone know how to do it? Quote Link to comment Share on other sites More sharing options...
Fluoresce Posted April 19, 2009 Author Share Posted April 19, 2009 Does anybody know how to do this? I have asked in two other forums and nobody has responded. Is it very difficult? Quote Link to comment Share on other sites More sharing options...
Kieran Menor Posted April 19, 2009 Share Posted April 19, 2009 As far as I know, clipboard manipulation is only supported in Internet Explorer. I would guess that other browsers do not support it because of the obvious security issues. Some people may have sensitive data in their clipboard while browsing the web. I am pretty sure it should be possible with Flash, though. Quote Link to comment Share on other sites More sharing options...
Fluoresce Posted April 19, 2009 Author Share Posted April 19, 2009 Thanks, Boom.dk. After looking for a Flash answer, I found Zero Clipboard. It looks quite promising. However, as a complete newbie to both Flash and Javascript, I can't tell if it can be adapted to work in the way that I explained above. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.