中文(繁体)
<!--完成此效果須兩步第一步是把下面程式碼放到<head>區域中--> <script> function runEx(cod1) { cod=document.all(cod1) var code=cod.value ; if (code!=""){ var newwin=window.open('','',''); //開啟一個視窗並賦給變數newwin。 newwin.opener = null // 防止程式碼對頁面修改newwin.document.write(code); //向這個開啟的視窗寫入程式碼code,這樣就實作了運行程式碼功能。 newwin.document.close(); } } //複製文字網域程式碼function cycode(obj) { var rng = document.body.createTextRange(); rng.moveToElementText(obj); rng.scrollIntoView(); rng.select( ); rng.execCommand("Copy"); window.status="高亮度包含的程式碼已複製到剪貼簿!Contents highlighted and copied to clipboard!" setTimeout("window.status=''",1800) rng .collapse(false); } //另存程式碼function svcode(obj) { var winname = window.open('', '_blank', 'top=10000'); winname.document.open('text/html', 'replace'); winname.document.writeln(obj.value); winname.document.execCommand('saveas','','code.htm'); winname.close(); } </script> <!- -第二步是把下面程式碼放到<body>區域--> <TEXTAREA rows='12' cols='78' class='fm' id='code'> <!-- http://www .downcodes.com/bbs--> </TEXTAREA> <INPUT onclick="runEx('code')" type="button" value="運行代碼" style="cursor:hand"onFocus="this.blur( )"> <input type="button" name="Submit" value="複製到剪貼簿" onClick="cycode(code)" style="cursor:hand;width:95px" onFocus="this.blur() "> <input type="button" value="另存代碼" onclick="svcode(code)" style="cursor:hand" onFocus="this.blur()">