一段JS代碼模仿SINA的廣告條

<script> function runCode() //定義一個運行代碼的函數, { var code=event.srcElement.parentElement.children[0].value;//即要運行的代碼。 var newwin=window.open('','',''); //打開一個窗口並賦給變量newwin。 newwin.opener = null // 防止代碼對論談頁面修改 newwin.document.write(code); //向這個打開的窗口中寫入代碼code,這樣就實現了運行代 碼功能。 newwin.document.close(); } </script>


[Ctrl+A 全部選擇 提示:你可先修改部分代碼,再按運行]
發佈了46 篇原創文章 · 獲贊 3 · 訪問量 29萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章