cnblogs csdn 代码运行框实现代码
作者:bea
下面这个是cnblogs的实现代码 代码如下: <script type="text/javascript"> function runCode(obj) { var winname = window.open('', "_blank", ''); winname.document.open('text/html', 'replace'); winname.document.write(obj.value); winname.document.clos
下面这个是cnblogs的实现代码
代码如下:
<script type="text/javascript">
function runCode(obj) {
var winname = window.open('', "_blank", '');
winname.document.open('text/html', 'replace');
winname.document.write(obj.value);
winname.document.close();
}
</script>
<textarea style="width: 80%" id="code1" rows="10">
<script type="text/javascript">
alert("Got it!");
</script>
</textarea><br/ />
<input type="button" value="run" onclick="runCode(document.getElementById('code1'))"/>
下面这个是 csdn下实现代码。
代码如下:
<script type="text/javascript"><!--
function viewPage(html) {
var page = window.open('', '', '');
page.opener = null;
page.document.write(html);
page.document.close();
}
// --></script>
<a href="javascript:viewPage(document.getElementsByTagName('textarea')[0].value)">运行代码</a></p>
<p><textarea cols="83" rows="15" name="code" class="xhtml">
<script>
alert('');
</script>
</textarea>
有用 | 无用
代码如下:
<script type="text/javascript">
function runCode(obj) {
var winname = window.open('', "_blank", '');
winname.document.open('text/html', 'replace');
winname.document.write(obj.value);
winname.document.close();
}
</script>
<textarea style="width: 80%" id="code1" rows="10">
<script type="text/javascript">
alert("Got it!");
</script>
</textarea><br/ />
<input type="button" value="run" onclick="runCode(document.getElementById('code1'))"/>
下面这个是 csdn下实现代码。
代码如下:
<script type="text/javascript"><!--
function viewPage(html) {
var page = window.open('', '', '');
page.opener = null;
page.document.write(html);
page.document.close();
}
// --></script>
<a href="javascript:viewPage(document.getElementsByTagName('textarea')[0].value)">运行代码</a></p>
<p><textarea cols="83" rows="15" name="code" class="xhtml">
<script>
alert('');
</script>
</textarea>
有用 | 无用
猜你喜欢
您可能感兴趣的文章:
- Jquery AJAX 框架的使用方法
- JQuery打造PHP的AJAX表单提交实例
- jQuery get和post 方法传值注意事项
- 实用的层滑开js实现代码
- 纯JS图片批量预加载技术代码
- CSS鼠标悬停菜单 图片交换技术实现
- CSS Filter背景透明提示
- MAC官方菜单纯CSS实现灰色会换色
- js window.onload 加载多个函数的方法
- jquery tree 可编辑节点实现代码(jquery一句话节点菜单)
- 深入认识javascript中的eval函数
- javascript 按回车键相应按钮提交事件
- JQuery 解析多维的Json数据格式
- javascript(jquery)利用函数修改全局变量的代码
- 一个可以兼容IE FF的加为首页与加入收藏实现代码
- JS OOP包机制,类创建的方法定义
- JQuery 网站换肤功能实现代码
- Javascript结合css实现网页换肤功能
- 简单实用的HTML到UBB转换脚本工具实现说明