<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题</title>
<script language="JavaScript" type="text/JavaScript">
//运行文本域代码
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();
}
}
</script>
</head>
<body>
<textarea name="textarea" cols="90" rows="14" id="rn01">加入要运行的代码</textarea>
<INPUT onClick="runEx('rn01')" type="button" class="toolsmtbtn" value="运行代码" style="cursor:hand">
</body>
</html>