动态生成的html代码

//=====在网站找到了解决方法=====
//动态生成的html代码
var htmlCode = '<html><head><title>代码</title></head><body><div style=“width:500px;height:300px;border:1px solid #dbdbdb;”>这里是代码</div></body></html>';

//打开浏览器窗口,并运行html代码
var codeWin = window.open("", "代码预览", "status=no,menuber=yes,toolbar=no,height=500,width=800");
codeWin.document.open();
codeWin.document.write(htmlCode);
codeWin.document.close();
posted @ 2016-04-13 19:15  happyu0223  阅读(567)  评论(0编辑  收藏  举报