<div class="codetitle"> <span><a style="CURSOR: pointer" data="57339" class="copybut" id="copybut57339" onclick="doCopy('code57339')"><u>複製程式碼</u></a></span> 程式碼如下:</div> <div class="codebody" id="code57339"> <br><script type="text/javascript" language="javascript"> <BR> //複製到剪切板js程式碼<BR> function copyToClipBoard(s) { <BR> if (window.clipboardData) { <BR> window.clipboardData.setData( "Text", s); <BR> alert("已複製到剪切板!" "n" s); <BR> <BR> window.location = s; <BR> try { <BR> netscape.security.PrivilegeManager.enablePrivilege(" { <BR> alert("瀏覽器拒於! 請在瀏覽器網址列輸入'about:config'並回車 接著將'signed.applets.codebase_principal_support'設定為'true'"); <BR> } <BR> widget/clipboard;1'].createInstance(Components.interfaces .nsIClipboard); <BR> if (!clip) <BR> var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable); <BR> trans.addDataFlavor('text/unicode'); <BR> var str = new Object(); <BR> var str = Components.classes["@mozilla.org/supports-string;1"].createIn var copytext = s; <BR> str.data = copytext; <BR> trans.setTransferData("text/unicode", str, copytext.length * 2); < <BR> if (!clip) <BR> clip.setData(trans, null, clipid.kGlobalClipboard); <BR> alert("已複製到剪切板! " "n" s) <BR> } <BR> }</script><br><br> </div>