当前位置: 代码迷 >> ASP >> 做一个成效预览的功能
  详细解决方案

做一个成效预览的功能

热度:64   发布时间:2013-02-19 11:11:40.0
做一个效果预览的功能
网面上有一个文本框和一个按钮,文本框中是一段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>
  相关解决方案