[JavaScript] js实现简单的代码运行框【转】

<script type="text/javascript">// <![CDATA[

  
function runCode(obj) {
var winname = window.open(''"_blank"'');
winname.document.open('text/html''replace');
winname.document.write(obj.value);
winname.document.close();
}
// ]]></script>
<p>
<textarea rows="10" id="code1" style="width: 80%;">
这里是要输入的内容
</textarea><br />
<input onclick="runCode(document.getElementById('code1'))" value="运行" type="button" />
</p>
 
 
 
https://www.cnblogs.com/xupeiyu/p/3920055.html
posted on 2021-04-28 17:13  3D入魔  阅读(183)  评论(0编辑  收藏  举报