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?

[Webinar] Streamline your web hosting managementRegister Today

x
 
ZhaawZConnect With a Mentor Software 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_jwConnect With a Mentor Commented:
Looks like it's some JavaScript, and in IE only.

http://www.experts-exchange.com/Web/Web_Languages/JavaScript/Q_20331469.html
0
All Courses

From novice to tech pro — start learning today.