在ie的菜单栏里找到“文件”>>“页面设置”,把页眉页脚的文本框里面的内容清空。

解决方案 »

  1.   

    <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()>
      

  2.   

    如果没事请看杀手锏
    http://blog.csdn.net/gjd111686/gallery/27646.aspx
      

  3.   

    <object id="Factory" style="display:none" viewastext
    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>
      

  4.   

    非常感谢楼上的,早晨的问题就是你帮助解决的,我是想在用户已经在别的页面点击了打印之后,不给他设置机会直接打印。所以我用了以下代码:
    <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>
    你给我横向设置的代码,我看不太明白,直接用上之后系统提示有错误!能不能帮我再看看?
      

  5.   

    控件已经下载了但是,系统提示:Invalid or missing publishing license
    能不能像前面设置页眉页脚一样的设置啊?其实我只保留Factory.printing.SetMarginMeasure(2);一项的时候,查看浏览器的页面设置已经该成了横向打印,但是由于有这个错误提示,后面的print()就不执行了。
      

  6.   

    你用try{}catch(e){}可以避免出错,打印不用它,因为你没有publishing license
      

  7.   

    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)
    {}
    }
      

  8.   

    <object id="Factory" style="display:none" viewastext
    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();去掉打印就可以执行,但是,横向设置就没有了.
      

  9.   

    非常感谢大家的帮助,特别是 gjd111686(数字金刚)很想向你好好学学!再次希望你能加我为好友,我的qq号10190504
      

  10.   

    你有ScriptX.cab控件吗?免费的控件功能太少了,
      

  11.   

    <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服务器不能创建对象”;不知道怎么解决
      

  12.   

    看看这个打印小组件
    http://www.fcsoft.com.cn/eprint/index.htm 
    可以修改页眉页脚,是象scriptx一样的组件