我现在用的页面打印代码如下<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>打印</title>
<style media=print> 
.noprint{display:none;} 
</style> 
<script>
function doPageSet(){ 
WB.ExecWB(8,1) 

function doPreview(){ 
WB.ExecWB(7,1) 

</script>
<OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WB width=0 VIEWASTEXT></OBJECT> </head><body><input name="Submit4" type="button"  onClick="javascript:window.print()" value="打印页面" class="noprint" > 
<input name="Submit5" type="button"  onClick="doPreview()" value="打印预览" class="noprint" >
<input name="Submit6" type="button"  onClick="doPageSet()" value="页面设置" class="noprint" > 
</body>
</html>我想实现以下几个功能
1.自动屏蔽不打印 页眉页脚 和 网页网址
2.如果点打印页面后,没有成功打印(例如:打印机没纸,打印机连接失败),可以给予提示,说打印失败怎么实现~谢谢

解决方案 »

  1.   


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>打印</title>
    <style media=print> 
    .noprint{display:none;} 
    </style> 
    <script>
        function doPageSet(){ 
        WB.ExecWB(8,1) 
        } 
        function doPreview(){ 
        WB.ExecWB(7,1) 
        } 
    </script>
    <OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WB width=0 VIEWASTEXT></OBJECT> </head><body>
    <div id='页眉' class=noprint>
    <input name="Submit4" type="button"  onClick="javascript:window.print()" value="打印页面" > 
    <input name="Submit5" type="button"  onClick="doPreview()" value="打印预览" >
    <input name="Submit6" type="button"  onClick="doPageSet()" value="页面设置" > 
    </div><div id='页脚' class=noprint>
    kkkkkkkkkkkk
    </div>
    </body>
    </html>
      

  2.   

    谢谢~!不过这个你理解错了,可能我没说清楚
    我说的页眉页脚是指,打印的时候,他自动打印出来的 该页面的网址 和 页面的<title>标签
    并不是说打印按钮之类的东西