function preview() {
bdhtml = window.document.body.innerHTML;
sprnstr = "<!--startprint-->";
eprnstr = "<!--endprint-->";
prnhtml = bdhtml.substr(bdhtml.indexOf(sprnstr)+17);
prnhtml = prnhtml.substring(0, prnhtml.indexOf(eprnstr));
window.document.body.innerHTML = prnhtml;
window.print();
window.close();
}
//打印页面设置
function printsetup() {
wb.execwb(8, 1);
}
//打印页面预览
function printpreview() {
wb.execwb(7, 1);
}
//打印
function printit() {
if (confirm('确定打印吗?')) {
wb.execwb(6, 6)
}
}
用一个js文件存储这些,然后在页面上引用你命名的文件,在js中调用方法就可以了