<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>RunCode Example</title>
<script>
function runCode(RunCode)//定义函数。
{
var code=RunCode.value;
//要运行的代码,即textarea的内容,RunCode是textarea的name
var newwin=window.open('','','');
//打开一个窗口并赋给变量newwin
newwin.opener = null;
//防止代码对页面修改
newwin.document.write(code);
//向这个打开的窗口中写入代码code
newwin.document.close();
}
</script>
<textarea name="RunCode1" style="width:274; height:167">
<b>Welcome to Betty's Blog:</b><br>
<a href="http://blog.csdn.net/cutebab0888">
http://blog.csdn.net/cutebab0888</a><BR></textarea><br><BR>
<INPUT name="button" type=button οnclick=runCode(RunCode1) value="运行代码">
仿蓝色理想的“运行代码”功能
最新推荐文章于 2024-09-18 09:47:26 发布