qq在线客服代码以及js操作剪贴板代码[支持 IE firefox] |
网站在线客服系统 1263202635 作者:刘晴 来源: 文字大小:[大][中][小] |
代码: <html> <body> <div> <a href="tencent://Message/?Uin=791748668&websiteName=www.wibowibo.com&Menu=yes"><img border="0" SRC="http://wpa.qq.com/pa?p=1:791748668:14" alt="点击跟客户交谈"></a> <a href="http://wpa.qq.com/msgrd?V=1&Uin=304275958&Site=a-hai.net&Menu=yes"> <img border="0" SRC='http://wpa.qq.com/pa?p=1:304275958:3' alt="联系客服"></a> <a href="http://wpa.qq.com/msgrd?V=1&Uin=791748668&Site=a-hai.net&Menu=yes"> <img border="0" SRC='http://wpa.qq.com/pa?p=1:791748668:3' alt="联系客服"></a> <a href="http://sighttp.qq.com/cgi-bin/check? sigkey=e33844527909a0bf5905ce8c59aa4e0d46ede9b2d545e4aa8e17397c52bfcc0dd44882f22fdfbc8c93430 91031d09446"; target=_blank; onclick="var tempSrc='http://sighttp.qq.com/wpa.js? rantime='+Math.random() +'&sigkey=e33844527909a0bf5905ce8c59aa4e0d46ede9b2d545e4aa8e17397c52bfcc0dd44882f22fdfbc8c93 43091031d09446';var oldscript=document.getElementById('testJs');var newscript=document.createElement('script');newscript.setAttribute('type','text/javascript'); newscript.setAttribute('id', 'testJs');newscript.setAttribute('src',tempSrc);if(oldscript == null){document.body.appendChild(newscript);}else{oldscript.parentNode.replaceChild (newscript, oldscript);}return false;"><img border="0" SRC='http://wpa.qq.com/pa? p=1:304275958:3' alt="联系客服"></a> </div> <script> function copyToClipboard() { var d=document.all("source").value; copyToClipboardAll(d); } function copyToClipboardAll(txt) { if (window.clipboardData) { window.clipboardData.clearData(); window.clipboardData.setData("Text", txt); } else if (navigator.userAgent.indexOf("Opera") != -1) { window.location = txt; } else if (window.netscape) { try { netscape.security.PrivilegeManager .enablePrivilege("UniversalXPConnect"); } catch (e) { alert("你使用的FireFox浏览器,复制功能被浏览器拒绝!\n请在浏览器地址栏输入 “about:config”并回车。\n然后将“signed.applets.codebase_principal_support”双击,设置为 “true”"); return; } var clip = Components.classes['@mozilla.org/widget/clipboard;1'] .createInstance(Components.interfaces.nsIClipboard); if (!clip) return; var trans = Components.classes['@mozilla.org/widget/transferable;1'] .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-string;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); } } </script> <BODY > <button onclick="copyToClipboard();">拷贝</button> <input type="text" size=20 id="source" value="测试数据"> <br> <button onclick="alert(window.clipboardData.getData('text'));">显示</button> <button onclick="window.clipboardData.clearData('text');">清空</button> </body> </html> |