我使用了ie自带的WebBrowser
但是
document.all.WebBrowser.ExecWB(6,1)是打印
google了一下说
document.all.WebBrowser.ExecWB(6,6)是直接打印,但是不成功打印的方法是:<script language="javascript">
function printsetup(){
// 打印页面设置
try{
document.all.WebBrowser.execwb(8,1);
}catch(e){
alert("您的浏览器不支持此功能,需要5.5以上版本");
}
}
function printpreview(){
// 打印页面预览
try{
document.all.WebBrowser.execwb(7,1);
}catch(e){
alert("您的浏览器不支持此功能,需要5.5以上版本");
}
} function printit()
{
if (confirm('确定打印吗?')) {
try{
document.all.WebBrowser.ExecWB(6,6);
}catch(e){
alert("您的浏览器不支持此功能,需要5.5以上版本");
}
}
}
</script>
调用的按钮:<input type="button" name="button_show" class="NOPRINT" value="打印预览" onclick="javascript:printpreview();">
<input type="button" class="NOPRINT" value="打 印" onClick="javascript:printit()">
<input type="button" name="button_setup" class="NOPRINT" value="打印页面设置" onclick="javascript:printsetup();">
但是
document.all.WebBrowser.ExecWB(6,1)是打印
google了一下说
document.all.WebBrowser.ExecWB(6,6)是直接打印,但是不成功打印的方法是:<script language="javascript">
function printsetup(){
// 打印页面设置
try{
document.all.WebBrowser.execwb(8,1);
}catch(e){
alert("您的浏览器不支持此功能,需要5.5以上版本");
}
}
function printpreview(){
// 打印页面预览
try{
document.all.WebBrowser.execwb(7,1);
}catch(e){
alert("您的浏览器不支持此功能,需要5.5以上版本");
}
} function printit()
{
if (confirm('确定打印吗?')) {
try{
document.all.WebBrowser.ExecWB(6,6);
}catch(e){
alert("您的浏览器不支持此功能,需要5.5以上版本");
}
}
}
</script>
调用的按钮:<input type="button" name="button_show" class="NOPRINT" value="打印预览" onclick="javascript:printpreview();">
<input type="button" class="NOPRINT" value="打 印" onClick="javascript:printit()">
<input type="button" name="button_setup" class="NOPRINT" value="打印页面设置" onclick="javascript:printsetup();">
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货