cnblogs 运行代码功能尝试
发布日期:2021-08-18 00:51:47 浏览次数:1 分类:技术文章

本文共 550 字,大约阅读时间需要 1 分钟。

转自:

cnblogs 运行代码功能尝试,使用cnblogs的朋友可以参考下。

1 
21 22 23 32 33 34 35 37 38 39

 

首先定义个文本域并且给个ID

<textarea id="O_txt_1" rows="8" cols="80"> <!--要运行的代码--> </textarea>
然后定义个按钮
<input type="button" value="运行代码" οnclick="runCode('O_txt_1')" />
最后当然是要写函数了,代码如下:

1 function runCode(id){ 2 var obj=document.getElementById(id); 3 var win = window.open('', "_blank", ''); 4 win.document.open('text/html', 'replace'); 5 win.opener = null; 6 win.document.write(obj.value); 7 win.document.close(); 8 }

转载于:https://www.cnblogs.com/jQing/archive/2012/06/14/2549054.html

转载地址:https://blog.csdn.net/weixin_30872733/article/details/99323587 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:python - HTMLTestRunner 测试报告模板设置
下一篇:才趟过的一个坑,css造成的Validform表单提交按钮点击无效

发表评论

最新留言

做的很好,不错不错
[***.243.131.199]2024年05月05日 02时26分12秒