Solved

Copy to Clipboard

Posted on 2004-04-05
3
359 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
This article discusses four methods for overlaying images in a container on a web page
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

943 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now