function printPreview()
{
var printWindow = window.open("","_blank");
var str = "<OBJECT id=WebBrowser classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 width=0></OBJECT>"
var s = "<html>\r\n";
s += "<head>";
s += "<LINK href='../pic/css.css' type='text/css' rel='stylesheet'>";
s += "<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>";
s += "</head>";
s += "<body><center><br>";
s += "<div align=center style='width:96%'>";
s += document.frames.pishi.document.body.outerHTML;
s += "</div>";
s += "</center></body>";
s += "</html>";
printWindow.document.write(s);
printWindow.document.close();
printWindow.document.body.insertAdjacentHTML("beforeEnd", str);
printWindow.document.all.WebBrowser.ExecWB(7,1);
printWindow.close();
}
{
var printWindow = window.open("","_blank");
var str = "<OBJECT id=WebBrowser classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 width=0></OBJECT>"
var s = "<html>\r\n";
s += "<head>";
s += "<LINK href='../pic/css.css' type='text/css' rel='stylesheet'>";
s += "<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>";
s += "</head>";
s += "<body><center><br>";
s += "<div align=center style='width:96%'>";
s += document.frames.pishi.document.body.outerHTML;
s += "</div>";
s += "</center></body>";
s += "</html>";
printWindow.document.write(s);
printWindow.document.close();
printWindow.document.body.insertAdjacentHTML("beforeEnd", str);
printWindow.document.all.WebBrowser.ExecWB(7,1);
printWindow.close();
}
解决方案 »
- 鼠标悬浮和点击后的样式一样?现在悬浮有效果 点击后和正常一样,如何使点击后的样式和悬浮的样式一样?高手请教!!!
- 如何处理$.getjson 返回值 为空的问题
- 用什么框架合适?
- JAVASCRIPT 如何读取 ACTIVEX 的字符串数组属性?
- 请帮忙改正一下这句话的错误!
- 在代码中控制图片按钮的disabled问题,请进:
- 用window.showModalDialog打开的新窗口返回参数问题
- 请问有谁知道怎样来控制IE 里面的Internet选项里面的,高级,选种打印背景和图片!!
- 内部网想做一个网站访问总量计数器,没有asp权限,如何用javascript实现??
- js 做的计时器,怎么输出00-00-00格式
- javascript打印问题,请多多帮忙!
- 类似下拉菜单,不过点击后是横向展开。请问在哪里又啊。
function testObj(objname) {
try {
var obj = eval(objname);
if (obj!=null)
return true;
}
catch(e) {
}
return false;
}var w;
function print_obj(obj) {
w = window.open("about:blank", "", "");
while (!testObj("w.document.body")) {
}
w.document.body.innerHTML = obj.outerHTML;
w.print();
w.close();
}
</script>
<input type="button" value="打印" onclick="print_obj(document.frames.pishi.document.body)">