Copy to Clipboard

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
webrehabAsked:
Who is Participating?
 
ZhaawZSoftware DeveloperCommented:
<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
 
snoyes_jwCommented:
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
 
snoyes_jwCommented:
Looks like it's some JavaScript, and in IE only.

http://www.experts-exchange.com/Web/Web_Languages/JavaScript/Q_20331469.html
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.