<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>