打印浏览器内容的时候如何去掉页眉页脚? 在ie的菜单栏里找到“文件”>>“页面设置”,把页眉页脚的文本框里面的内容清空。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <script language="JavaScript"> var HKEY_Root,HKEY_Path,HKEY_Key;HKEY_Root="HKEY_CURRENT_USER";HKEY_Path="\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";//设置网页打印的页眉页脚为空function PageSetup_Null(){ try { var Wsh=new ActiveXObject("WScript.Shell"); HKEY_Key="header"; Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,""); HKEY_Key="footer"; Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,""); } catch(e){}}//设置网页打印的页眉页脚为默认值function PageSetup_Default(){ try { var Wsh=new ActiveXObject("WScript.Shell"); HKEY_Key="header"; Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"&w&b页码,&p/&P"); HKEY_Key="footer"; Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"&u&b&d"); } catch(e){}}</script><input type="button" value="清空页码" onclick=PageSetup_Null()><input type="button" value="恢复页码" onclick=PageSetup_Default()> 如果没事请看杀手锏http://blog.csdn.net/gjd111686/gallery/27646.aspx <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(){ 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;} </script> 非常感谢楼上的,早晨的问题就是你帮助解决的,我是想在用户已经在别的页面点击了打印之后,不给他设置机会直接打印。所以我用了以下代码:<script language="javascript"><!--var HKEY_Root,HKEY_Path,HKEY_Key;HKEY_Root="HKEY_CURRENT_USER";HKEY_Path="\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";function PageSetup_Null(){ try { var Wsh=new ActiveXObject("WScript.Shell"); HKEY_Key="header"; Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,""); HKEY_Key="footer"; Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,""); } catch(e){}}PageSetup_Null();window.print();--></script>你给我横向设置的代码,我看不太明白,直接用上之后系统提示有错误!能不能帮我再看看? 控件已经下载了但是,系统提示:Invalid or missing publishing license能不能像前面设置页眉页脚一样的设置啊?其实我只保留Factory.printing.SetMarginMeasure(2);一项的时候,查看浏览器的页面设置已经该成了横向打印,但是由于有这个错误提示,后面的print()就不执行了。 你用try{}catch(e){}可以避免出错,打印不用它,因为你没有publishing license 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) {}} <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><script language="javascript"><!--var HKEY_Root,HKEY_Path,HKEY_Key;HKEY_Root="HKEY_CURRENT_USER";HKEY_Path="\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";function PageSetup_Null(){ try { var Wsh=new ActiveXObject("WScript.Shell"); HKEY_Key="header"; Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,""); HKEY_Key="footer"; Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,""); } catch(e){}}function SetPrintSettings(){ Factory.printing.SetMarginMeasure(2);}PageSetup_Null();SetPrintSettings();window.print();--></script>我这样写但是,window.print();没有执行啊!如果我把SetPrintSettings();去掉打印就可以执行,但是,横向设置就没有了. 非常感谢大家的帮助,特别是 gjd111686(数字金刚)很想向你好好学学!再次希望你能加我为好友,我的qq号10190504 你有ScriptX.cab控件吗?免费的控件功能太少了, <script language="javascript"><!--var HKEY_Root,HKEY_Path,HKEY_Key;HKEY_Root="HKEY_CURRENT_USER";HKEY_Path="\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";function PageSetup_Null(){ try { var Wsh=new ActiveXObject("WScript.Shell"); HKEY_Key="header"; Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,""); HKEY_Key="footer"; Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,""); } catch(e){}}PageSetup_Null();window.print();--></script>我现在使用了这个程序不能执行,出错信息为“Automation服务器不能创建对象”;不知道怎么解决 看看这个打印小组件http://www.fcsoft.com.cn/eprint/index.htm 可以修改页眉页脚,是象scriptx一样的组件 utf-8页面上限制输入某种语言--100分,在线等 js 用split textarea内的断行问题 简单的问题,你不一定解决的掉,O(∩_∩)O哈哈~ 网络端口! 在textarea中显示html页面 请教:表格中输入框失去焦点,使表格的底色改变??? 一个很简单但很急的javascript问题,请指教,谢谢! 关于替换图片的问题,都来看看,比较菜 提问ONCHANGE事件 高分求解!(500分)用IE打印Web页时如何不打印出按钮? (up有分) 调用打印的问题。。。。急 这样如何显示????
var HKEY_Root,HKEY_Path,HKEY_Key;
HKEY_Root="HKEY_CURRENT_USER";
HKEY_Path="\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";
//设置网页打印的页眉页脚为空
function PageSetup_Null()
{
try
{
var Wsh=new ActiveXObject("WScript.Shell");
HKEY_Key="header";
Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"");
HKEY_Key="footer";
Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"");
}
catch(e){}
}
//设置网页打印的页眉页脚为默认值
function PageSetup_Default()
{
try
{
var Wsh=new ActiveXObject("WScript.Shell");
HKEY_Key="header";
Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"&w&b页码,&p/&P");
HKEY_Key="footer";
Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"&u&b&d");
}
catch(e){}
}
</script>
<input type="button" value="清空页码" onclick=PageSetup_Null()>
<input type="button" value="恢复页码" onclick=PageSetup_Default()>
http://blog.csdn.net/gjd111686/gallery/27646.aspx
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()
{
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;
}
</script>
<script language="javascript">
<!--
var HKEY_Root,HKEY_Path,HKEY_Key;
HKEY_Root="HKEY_CURRENT_USER";
HKEY_Path="\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";
function PageSetup_Null()
{
try
{
var Wsh=new ActiveXObject("WScript.Shell");
HKEY_Key="header";
Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"");
HKEY_Key="footer";
Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"");
}
catch(e){}
}
PageSetup_Null();
window.print();
-->
</script>
你给我横向设置的代码,我看不太明白,直接用上之后系统提示有错误!能不能帮我再看看?
能不能像前面设置页眉页脚一样的设置啊?其实我只保留Factory.printing.SetMarginMeasure(2);一项的时候,查看浏览器的页面设置已经该成了横向打印,但是由于有这个错误提示,后面的print()就不执行了。
{
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)
{}
}
codeBase=http://www.meadroid.com/scriptx/ScriptX.cab#Version=5,60,0,360
classid=clsid:1663ed61-23eb-11d2-b92f-008048fdd814 viewastext>
</object>
<script language="javascript">
<!--
var HKEY_Root,HKEY_Path,HKEY_Key;
HKEY_Root="HKEY_CURRENT_USER";
HKEY_Path="\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";
function PageSetup_Null()
{
try
{
var Wsh=new ActiveXObject("WScript.Shell");
HKEY_Key="header";
Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"");
HKEY_Key="footer";
Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"");
}
catch(e){}
}
function SetPrintSettings()
{
Factory.printing.SetMarginMeasure(2);
}
PageSetup_Null();
SetPrintSettings();
window.print();
-->
</script>
我这样写但是,window.print();没有执行啊!如果我把SetPrintSettings();去掉打印就可以执行,但是,横向设置就没有了.
<!--
var HKEY_Root,HKEY_Path,HKEY_Key;
HKEY_Root="HKEY_CURRENT_USER";
HKEY_Path="\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";
function PageSetup_Null()
{
try
{
var Wsh=new ActiveXObject("WScript.Shell");
HKEY_Key="header";
Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"");
HKEY_Key="footer";
Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"");
}
catch(e){}
}
PageSetup_Null();
window.print();
-->
</script>
我现在使用了这个程序不能执行,出错信息为“Automation服务器不能创建对象”;不知道怎么解决
http://www.fcsoft.com.cn/eprint/index.htm
可以修改页眉页脚,是象scriptx一样的组件