Jump to content

Copy To Pasteboard


Recommended Posts

Hey all


I have a question about a copy button. I heard javascript can do this. But let me explain my situation and then see what my options are. I have a 4 column table with all the info. this table will be created using php pulling data from a mysql database.


Each coupon offer will have a code associated with it. I want to be able to have a button or even better have the code be a hyperlink where it can be clicked, and have the code copied to the pasteboard, so someone can paste it on another site.


Can someone point me in a direction?



Link to comment
Share on other sites

I have been scouring around a bit and can only come up with the JS script you mentioned.

From what I am able to gather, without client side scripting, and that includes JS, you may not be able to do what you ask.


I am still looking, though... I am just not as familiar with php as I would like to be yet.

Link to comment
Share on other sites

I found this script on hotscripts and it works fine when I place it by itself in a page. But what I want to do is use the cpanel > mysql and place it within the code column in my table- but not working. Check out my code.


><script LANGUAGE="JavaScript">

function ClipBoard() 
holdtext.innerText = copytext.innerText;
Copied = holdtext.createTextRange();

<SPAN ID="copytext">
</SPAN> <br>

<TEXTAREA ID="holdtext" STYLE="display:none;">
<a href="#" onClick="ClipBoard();">Copy</a>

Link to comment
Share on other sites

Join the conversation

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

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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...