Solved

Copy to Clipboard

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
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…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

777 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