日期:2014-05-16 浏览次数:20532 次
<!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 type="text/css" media="print" id="style1" >  
BODY{display:none}  /* 防打印 */ 
</style>
</head>
<body>
打印内容...
...
<input type="button" value="打印" onclick="allowPrint();" />
<script type="text/javascript">
function allowPrint(){
    var style = document.getElementById('style1');
    style.media = "none";
    window.print();
}
</script>
</body>
</html>
------解决方案--------------------
<input type="button"  value="打印" onclick ="document.body.style.cssText='display:block';wb.execwb(6,1)">
------解决方案--------------------
<style>
@media screen {
.input1 {display:none}
.input2 {}
}
  
    
@media print {
.input1 {}
.input2 {display:none}
}
</style>  
    
  ……   
  <body>   
  <input class="input1"  type="submit"   value="打印"   id=submit1   name=submit1 >   
  <input class="input2"  type="submit"   value="不打印,但可以看"   id=submit1   name=submit1 >   
  ……   
  </body>