打印浏览器页面时,怎么才能不弹出打印机选择窗口,使用默认打印机。 ie6自带的webbrowser object好像可以 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 使用webbrowser控件,然后调用execwb(6,1);就可以搞定! 我就是这么用的,出来打印机选择弹出窗口。-----------------<input name=Button onClick=document.all.WebBrowser.ExecWB(6,1) type=button value=打印><OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT> ----------------- var margin_top,margin_bottom,margin_left,margin_right,footer,headervar regedit = new ActiveXObject("WScript.Shell");function print_begin(){ margin_top=regedit.RegRead ("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_top"); margin_bottom=regedit.RegRead ("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_bottom"); margin_left=regedit.RegRead ("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_left"); margin_right=regedit.RegRead ("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_right"); //footer=regedit.RegRead ("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\footer"); //header=regedit.RegRead ("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\header"); regedit.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_top",print_top); regedit.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_bottom",print_bottom); regedit.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_left",print_left); regedit.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_right",print_right); //regedit.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\footer",print_footer); //regedit.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\header",print_header);}function print_end(){ regedit.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_top",margin_top); regedit.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_bottom",margin_bottom); regedit.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_left",margin_left); regedit.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_right",margin_right); //regedit.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\footer",footer); //regedit.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\header",header);} document.all.WebBrowser.ExecWB(6,1)改成document.all.WebBrowser.ExecWB(6,6) <object id="Factory" style="display:none" viewastextcodeBase=http://www.meadroid.com/scriptx/ScriptX.cab#Version=5,60,0,360classid=clsid:1663ed61-23eb-11d2-b92f-008048fdd814 viewastext></object><input type="button" value="打 印" onclick="Factory.printing.Print(true)"><input type="button" value="页面设置" onclick="Factory.printing.PageSetup()"><input type="button" value="打印预览" onclick="Factory.printing.Preview()"><input type="button" value="横向设置" onclick="SetPrintSettings()"><script>function SetPrintSettings(){ try { Factory.printing.SetMarginMeasure(2); Factory.SetPageRange(false,1,3); Factory.printing.printer="HP DeskJet 870C"; Factory.printing.copies=2; Factory.printing.collate=true; Factory.printing.paperSize="A4"; Factory.printing.paperSource="Manual feed"; Factory.printing.header="This is MeadCo"; Factory.printing.footer="Advanced Printing by ScriptX"; Factory.printing.portrait=false; Factory.printing.leftMargin=1.0; Factory.printing.topMargin=1.0; Factory.printing.rightMargin=1.0; Factory.printing.bottomMargin=1.0; } catch(e) {}} </script> JS web打印遇到的难题! JS冒泡问题【代码很少】 CKEditor在使用的时候,编辑框中总是默认带有P元素,应该如何去掉呢 数据显示不出来,求救! 梅花雪大哥的树怎么做成动态的啊 麻烦 大虾们 帮我看下这个效果为什么会这样 急!!在html中如何往表中指定的行中插入新的表<table></table> 关于JScript脚本语言的问题 请看一个关于window.open的问题! 请教关于用showModelessDialog打开一个末态显示的新窗口的问题。 页面后退问题,解决即给分,在线等待 Javascript 方面的问题请教!
-----------------
<input name=Button onClick=document.all.WebBrowser.ExecWB(6,1) type=button value=打印><OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT> -----------------
var regedit = new ActiveXObject("WScript.Shell");
function print_begin(){
margin_top=regedit.RegRead ("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_top");
margin_bottom=regedit.RegRead ("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_bottom");
margin_left=regedit.RegRead ("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_left");
margin_right=regedit.RegRead ("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_right");
//footer=regedit.RegRead ("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\footer");
//header=regedit.RegRead ("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\header"); regedit.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_top",print_top);
regedit.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_bottom",print_bottom);
regedit.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_left",print_left);
regedit.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_right",print_right);
//regedit.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\footer",print_footer);
//regedit.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\header",print_header);
}
function print_end(){
regedit.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_top",margin_top);
regedit.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_bottom",margin_bottom);
regedit.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_left",margin_left);
regedit.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_right",margin_right);
//regedit.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\footer",footer);
//regedit.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\header",header);
}
codeBase=http://www.meadroid.com/scriptx/ScriptX.cab#Version=5,60,0,360
classid=clsid:1663ed61-23eb-11d2-b92f-008048fdd814 viewastext>
</object>
<input type="button" value="打 印" onclick="Factory.printing.Print(true)">
<input type="button" value="页面设置" onclick="Factory.printing.PageSetup()">
<input type="button" value="打印预览" onclick="Factory.printing.Preview()">
<input type="button" value="横向设置" onclick="SetPrintSettings()">
<script>
function SetPrintSettings()
{
try
{
Factory.printing.SetMarginMeasure(2);
Factory.SetPageRange(false,1,3);
Factory.printing.printer="HP DeskJet 870C";
Factory.printing.copies=2;
Factory.printing.collate=true;
Factory.printing.paperSize="A4";
Factory.printing.paperSource="Manual feed";
Factory.printing.header="This is MeadCo";
Factory.printing.footer="Advanced Printing by ScriptX";
Factory.printing.portrait=false;
Factory.printing.leftMargin=1.0;
Factory.printing.topMargin=1.0;
Factory.printing.rightMargin=1.0;
Factory.printing.bottomMargin=1.0;
}
catch(e)
{}
}
</script>