<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=
" 80%;"
>
这里是要输入的内容
</textarea><br />
<input onclick=
"runCode(document.getElementById('code1'))"
value=
"运行"
type=
"button"
/>
</p>
https://www.cnblogs.com/xupeiyu/p/3920055.html