Solved

Copy to Clipboard

Posted on 2004-04-05
3
362 Views
Last Modified: 2006-11-17
I have seen a couple of sites, that are driven by php, using a link to copy code samples to the clipboard.  I am wondering how I can add this to a page that I am building.  I am not sure if it is a PHP or javascript function.

Thanks,
John
0
Comment
Question by:webrehab
  • 2
3 Comments
 
LVL 33

Expert Comment

by:snoyes_jw
ID: 10759266
Surely it's javascript or some other client-side thing; I don't see how server-side PHP could interact in any way with the client's clipboard.
0
 
LVL 33

Assisted Solution

by:snoyes_jw
snoyes_jw earned 250 total points
ID: 10759292
Looks like it's some JavaScript, and in IE only.

http://www.experts-exchange.com/Web/Web_Languages/JavaScript/Q_20331469.html
0
 
LVL 11

Accepted Solution

by:
ZhaawZ earned 250 total points
ID: 10760735
<script language="JavaScript">
function cbwrite (s) { window.clipboardData.setData("Text", s); }
</script>
<input id="txt" type="text"><input type="button" onClick="cbwrite(txt.value);" value="copy to clipboard">
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Echo Multiple values from multiple records 19 55
Make login page safer 3 31
MySQL Persistent Connections 10 32
Echo'd values in dropdowns 6 28
This article discusses how to create an extensible mechanism for linked drop downs.
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question