function clear_script(){ K1.value=K1.value.replace(/<script.*?>[\s\S]*?<\/script>|\s+on[a-zA-Z]{3,16}\s?=\s?"[\s\S]*?"|\s+on[a-zA-Z]{3,16}\s?=\s?'[\s\S]*?'|\s+on[a-zA-Z]{3,16}\s?=[^ >]+/ig,""); } 动态执行JavaScript脚本 function javascript(){ try{ eval(K1.value); }catch(e){ alert(e.message); } }