打印是浏览器控制滴,没开放接口,js无能为力。告知用户:文件->打印设置->手动清除页眉、页脚默认设置。

解决方案 »

  1.   

    <html>
    <head>
    <title> new document </title>
    <meta name="generator" content="editplus">
    <meta name="author" content="yc">
    <script language="vbscript">
    dim hkey_root,hkey_path,hkey_key
    hkey_root="hkey_current_user"
    hkey_path="\software\microsoft\internet explorer\pagesetup"
    "//设置网页打印的页眉页脚为空
    function pagesetup_null()
    on error resume next
    set regwsh = createobject("wscript.shell")
    hkey_key="\header"
    regwsh.regwrite hkey_root+hkey_path+hkey_key,""
    hkey_key="\footer"
    regwsh.regwrite hkey_root+hkey_path+hkey_key,""
    end function
    "//设置网页打印的页眉页脚为默认值
    function pagesetup_default()
    on error resume next
    set regwsh = createobject("wscript.shell")
    hkey_key="\header"
    regwsh.regwrite hkey_root+hkey_path+hkey_key,"&w&b页码,&p/&p"
    hkey_key="\footer"
    regwsh.regwrite hkey_root+hkey_path+
      

  2.   

    TO:chinmo
    就是说在IE7里不能通过JS来隐藏页眉和页脚咯?
      

  3.   

    当然,要么你就要写代码来改变客户端的注册表!
    但是,一般客户端没有wscript.shell
    那你想都不用想了!