Jump to content

[SOLVED] Do You Know How to do this . . . ?


Fluoresce

Recommended Posts

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?

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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 ?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.