网站制作

本类阅读TOP10

·IIS 安装配置全攻略
·用VS.NET打开网上下载的.NET web项目出错的解决办法
·HTML 4.0 语言快速参考
·限制TextArea区的文字输入数量
·如何在网页上实现进度条
·Apache的配置步骤及测试
·谈谈Jesse James Garrett提到的Ajax
·html基础学习笔记(2)
·页面垂直居中的两种方法
·用asp遍历目录下文件的例子

分类导航
VC语言Delphi
VB语言ASP
PerlJava
Script数据库
其他语言游戏开发
文件格式网站制作
软件工程.NET开发
实现蓝色理想的"运行代码"

作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站

效果如下,代码在下面:



 

代码:

<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="http://blog.csdn.net/catally">http://blog.csdn.net/catally</a>
</textarea><br>
<INPUT name="button" type=button onclick=runCode() value=运行代码>
</body>
</html>




相关文章

相关软件