最好的办法就是用JS把这块内容挖出来重新组织成一个页面再打印:
function printPreview()
{
try
{
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='css.css' type='text/css' rel='stylesheet'>";
s += "<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>";
s += "<meta content='F.R.Huang(meizz梅花雨)//www.meizz.com' name='author'>";
s += "</head>";
s += "<body><center><br>";
s += "<div align=center style='width:96%'>";
s += document.all.BILL.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(6,1);
printWindow.close();
}
catch(e)
{
alert("您的浏览器版本太低,请升级您的浏览器!");
}
}
function printPreview()
{
try
{
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='css.css' type='text/css' rel='stylesheet'>";
s += "<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>";
s += "<meta content='F.R.Huang(meizz梅花雨)//www.meizz.com' name='author'>";
s += "</head>";
s += "<body><center><br>";
s += "<div align=center style='width:96%'>";
s += document.all.BILL.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(6,1);
printWindow.close();
}
catch(e)
{
alert("您的浏览器版本太低,请升级您的浏览器!");
}
}
解决方案 »
- 用javascript写的一个小程序为什么他没有调用show()方法那
- 请教各位,能用js判断<embed>标签里的flash文件何时加载完毕么?
- 正则不匹配怎么写?
- 急!text框内值改变问题...
- (\w)\1{4,}和(\w){4,}\1和(\w)\1{4,}\1的困惑
- 为什么这个方法不能保存cookie?
- 关于无间断滚动的问题
- 求教ajax问题, 高手进来点拨一下。
- 为什么我的“分页控件”在 640 * 480 的分辨率下会出错 !!!!!???????????
- (Javascript 参考手册【中英文版本】下载链接)里面有中文的吗?
- 关于在jsp中的javascript代码。
- 菜鸟求教:想做个bookmarklet书签,重新构造当前打开网页的网址然后新标签页打开,太菜了不会弄,非常感谢!!
function printTable()
{
for(var i = 0;i<otherdiv.length;i++)
{
otherdiv.style.visibility="hidden";
}
document.executeCommand("print");
for(var i = 0;i<otherdiv.length;i++)
{
otherdiv.style.visibility="visible";
}}
123
</table>
<script>
var op = window.open();
op.document.writeln(a.outerHTML);
op.document.writeln('<script>window.print()<\/script>');
</script>