[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
标签:runCode,text,JavaScript,js,代码运行,html,winname,document,open 来源: https://www.cnblogs.com/mazhenyu/p/14714919.html