网面上有一个文本框和一个按钮,文本框中是一段HTML代码,怎样点击按钮就能查看文本框中代码在网页中显示的效果。应该怎么写啊
------解决方案--------------------
<textarea id="html" style="width:100%;height:200px" > </textarea>
<button onclick="view()" >click</button>
<script>
function view(){
var win=open('');
win.document.open();
win.document.write( document.getElementById("html").value);
win.document.close();
}
</script>