查看 按钮 测试 新页面 新窗口

HTML:
<textarea id="demo1" style="margin: 0px; height: 200px; width: 232px;"></textarea>
<input type="button" value="测试" onclick="runCode('demo1')">
js:
function runCode(id) {
var obj = document.getElementById(id);
var TestWin = open('');
TestWin.opener = null;
TestWin.document.write(obj.value);
TestWin.document.close();
}