部落格園 中 運行js

來源:互聯網
上載者:User

標籤:rip   amp   dos   type   cdata   java   class   win   div   

<script type="text/javascript">alert("alert彈出?");</script>

 

這裡放入啟動並執行Html代碼。

 

<p><textarea id="con" style="height: 167px; width: 375px; margin: 2px;">&lt;script type="text/javascript"&gt;alert("alert彈出?");&lt;/script&gt;</textarea></p><p><input id="btn" onclick="btn();" type="button" value="運行代碼" /></p><p>&nbsp;</p><p><textarea id="theCode" style="width: 450px; height: 300px;" title="雙擊運行代碼" ondblclick="runCode(‘theCode‘);">這裡放入啟動並執行Html代碼。</textarea><br /><input onclick="runCode(‘theCode‘)" type="button" value="運行代碼" /> <input onclick="doCopy(‘theCode‘)" type="button" value="複製代碼" /> <input onclick="doSave(‘theCode‘,‘test‘)" type="button" value="儲存代碼" /></p><script type="text/javascript">// <![CDATA[//執行代碼  var btn = document.getElementById("btn");    var con = document.getElementById("con");    if(btn && con){        btn.onclick = function(){            var newwin = window.open(‘‘, "_blank", ‘‘);            newwin.document.open(‘text/html‘, ‘replace‘);            newwin.opener = null;            newwin.document.write(con.value);            newwin.document.close();        }    }    function runCode(obj) {         var winname = window.open(‘‘, "_blank", ‘‘);         var content = document.getElementById(obj).value;         winname.document.open(‘text/html‘, ‘replace‘);         winname.opener = null         winname.document.writeln(content);         winname.document.close();     }        //複製代碼     function doCopy(obj){         var codeObj = document.getElementById(obj);         clipboardData.setData(‘text‘, codeObj.innerText);         alert(‘已經複製代碼‘);     }        // 另存新檔檔案     function doSave(obj, filename){           var win = window.open(‘‘, ‘_blank‘, ‘top=10000‘);         var code = document.getElementById(obj).innerText;         win.opener = null;         win.document.write(code);         win.document.execCommand(‘saveas‘, true, filename);         win.close();     }// ]]></script>

 

部落格園 中 運行js

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.