网页脚本运行代码功能特效,很多网站都有的,点击按钮运行textarea中的代码,新窗口打开。
<script>
function Preview()
{
var TestWin=open('','','');
TestWin.document.open('text/html','replace');
TestWin.document.write(code.value);
TestWin.document.close();
}
</script>
<textarea id=code cols=60 rows=15></textarea>
<br>
<button onclick=Preview() >运行</button>
提示:您可以先修改部分代码再运行
<script>
function Preview()
{
var TestWin=open('','','');
TestWin.document.open('text/html','replace');
TestWin.document.write(code.value);
TestWin.document.close();
}
</script>
<textarea id=code cols=60 rows=15></textarea>
<br>
<button onclick=Preview() >运行</button>
提示:您可以先修改部分代码再运行