欢迎访问:常州市武进区嘉泽中心小学网站 !今天是:
栏目列表
您现在的位置是:首页>>教师>>计算机技术>>网站制作技术>>文章内容
实现蓝色理想的运行代码
发布时间:2008-11-20   点击:   来源:本站原创   录入者:佚名
 

效果如下,代码在下面:



 

代码:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 1</title>
</head>
<body>
<script>
function 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="RunCode" style="width:274; height:167">
<b>Welcome to C's Blog:</b><br>
<a href=""></a>
</textarea><br>
<INPUT name="button" type=button onclick=runCode() value=运行代码>
</body>
</html>


附件:
    关闭窗口
    打印文档
    账号登录
    保持登录 忘记密码?
    账号与武进教师培训平台同步