Tip: you can modify some code before running
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>Compatible with copying IE and Firefox to the clipboard</title><meta http-equiv="content-type" content="text/html;charset=gb2312"></head><body><!--把下面代码加到<body>与</body>之间--><input type="text" id="copyValue" name="copyValue" value="www.zzsky.cn"><input type="submit" value="复制到剪贴板" onclick="copyToClipboard(document.getElementById('copyValue').value);"><script type="text/javascript">Function copyToClipboard (txt) {// IEif (window. clipboardData) {window. clipboardData. clearData (); window. clipboardData. setData ("Text", txt); alert ("IE copied successfully! ");} // Firefoxelse if (window. netscape) {try {netscape. security. privilegeManager. enablePrivilege ("UniversalXPConnect");} catch (e) {alert ("rejected by the browser! N enter 'about: config' in the address bar of the browser, press enter n, and then 'signed. applets. codebase_principal_support 'is set to 'true' ");} var clip = Components. classes ['@ mozilla.org/widget/clipboard1_1').createinstance (Components. interfaces. nsIClipboard); if (! Clip) {return;} var trans = Components. classes ['@ mozilla.org/widget/transferable1_1'assist.createinstance (Components. interfaces. nsITransferable); if (! Trans) {return;} trans. addDataFlavor ('text/unicode '); var str = new Object (); var len = new Object (); var str = Components. classes ["@ mozilla.org/supports-string1_1"]. createInstance (Components. interfaces. nsISupportsString); var copytext = txt; str. data = copytext; trans. setTransferData ("text/unicode", str, copytext. length * 2); var clipid = Components. interfaces. nsIClipboard; if (! Clip) {return false;} clip. setData (trans, null, clipid. kGlobalClipboard); alert ("Firefox copied successfully! ");}}</script></body></html>
Tip: you can modify some code before running