<script language="javascript">
function beforeprint()
{
    document.title = document.title + " - 你的标题"
}function afterprint()
{
//......
}window.document.onbeforeprint=beforeprint;
window.document.onafterprint=afterprint;
window.onbeforeprint=beforeprint;
window.onafterprint=afterprint;
</script>

解决方案 »

  1.   

    <html>
    <head>
      <title>打印页面</title>
    </head>
    <body>
    <object id="WebBrowser" width=0 height=0 classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object><input type="button" value="打印预览" onclick="WebBrowser.ExecWB(7,1)"><br>
    <input type="button" value="页面设置" onclick="WebBrowser.ExecWB(8,1);"><br>
    <input type="button" value="打印" onclick="window.print();"><br><script language="javascript">
    function beforeprint()
    {
        oldTitle = document.title;
        document.title = "你的标题"
    }function afterprint()
    {
        document.title = oldTitle;
    }window.document.onbeforeprint=beforeprint;
    window.document.onafterprint=afterprint;
    window.onbeforeprint=beforeprint;
    window.onafterprint=afterprint;
    </script></body>
    </html>
      

  2.   

    <head>
    <title>打印确认</title>
    <style media="print">
    .noprint { display: none }
    </style>
    </head>
    <body>
    <object id="factory" style="display:none" viewastext classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814" codebase="http://www.meadroid.com/scriptx/ScriptX.cab#Version=5,60,0,360"></object>
    <script defer>
    function window.onload() {
      factory.printing.header = "你要打印的页眉"
      factory.printing.footer = "你要打印的页脚"
      factory.printing.portrait = false
      idPrint1.disabled = false; // enable UI button
      idPrint2.disabled = false;
      idPrint3.disabled = false;
      idPrint4.disabled = false;
      factory.printing.leftMargin = 0.75
      factory.printing.topMargin = 1.5
      factory.printing.rightMargin = 0.75
      factory.printing.bottomMargin = 1.5
      }
    </script>
    <script>
    function printalert()
    {
     if(confirm("确定要打印吗"))
       factory.printing.Print(false);}
    </script>
    <div class=noprint align=center>
      <input id="idPrint1" type="button" class=input value="打印本页"
     onclick="printalert()">
      <input id="idPrint2" type="button" class=input value="页面设置"
     onclick="factory.printing.PageSetup()">
      <input id="idPrint3" type="button" class=input value="打印预览"
     onclick="factory.printing.Preview()">
      <input id="idPrint4" type="button"
     onclick="window.opener=null;window.close()" class=input value="关闭窗口">
    </div>
    <br>
    要打印的内容
    </body>
      

  3.   

    很多人不知道页眉、页脚的概念,在注册表里面是header、footer 并不是所说的Title。Title在浏览器的标题栏就能看见,而页眉、页脚只有在打印的时候才能看见,出现在打印纸的最上面和最下面。
    HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\PageSetup\headerHKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\PageSetup\footer
      

  4.   

    大哥们,页面上面叫Title 下面的叫什么来着?
      

  5.   

    你不是说了,页眉、页脚是在打印有的,Title是浏览器页面的(document.title)
    你要改的是页眉、页脚不是Title
    打开页面设置看到的就是在
    HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\PageSetup\header
    HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\PageSetup\footer
    的内容,修改它们就是了。<object id="factory" style="display:none" viewastext classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814" codebase="http://www.meadroid.com/scriptx/ScriptX.cab#Version=5,60,0,360"></object>
    是ActiveX组件,第一次用要下载,确定可以实现你要的功能,我用的很好。另一个办法是用WSH进行修改(98不一定行),我不懂。
      

  6.   

    我发现改Title.也能达到目的,现在我想知道状态栏上显示URL的变量是什么。
    就像表示标题的变量是Title.谢谢