运行html代码
2015-07-17 21:18
656 查看
<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>
相关文章推荐
- html教程
- html格式规范化—<option>内容空格问题
- html 学习
- Html——footer的使用
- IE8 中"HTML Parsing Error:Unable to modify the parent container element before the child element is c
- html
- HTML导入本地图片
- Html学习笔记2
- HTML实体符号代码速查表
- html的字符实体
- 无废话网页重构系列——(6)HTML主干结构:站点(site)、页面(page)
- HTML编程之实现文字水平居中
- html常用的标签
- HTML 5 应用程序缓存
- MVC HtmlHelper用法大全
- html dom渲染成图片
- html" TARGET
- html 图片拖动不出来的脚本
- p标签内不能包含块级元素
- HTML学习笔记(2)----HTML的发展历史