我在网站中写了一个自动生成DM单的程序,我现在想要通过带预览的方式来打印我生成的DM单,但现在我只知道打印整个网页的方法.请问各位高手,我怎么才能只打印我的DM单,而不打印其他不需要的东西!!!可开新贴给分!!200分
解决方案 »
- 求教,关于request用法
- 让我疯掉的JSP的问题
- 迷茫……,对以前没有web服务的web程序有所了解(请问tomcat)
- index.jsp里面include servlet后回不到index.jsp了!!怎么办?
- 100分!applet录音机的实现!
- 读取数据库时出现异常,大家帮忙看看!!
- 我想在后台做一个提交页面,能上传文字与图片混合排列的提交页面,图片可在文字中任意位置插入,图片最多上传5张。
- servlet单独测试通过了,但jsp调用servlet不成功!附源代码!
- ntext类型的乱码各位大虾帮忙看看
- hibernate查询,使用数据库能查到数据,但是用hql语句却返回null的问题!
- sos valuelist查找中文名称怎么查不到结果
- 请问有没有可以调试 javascript的工具?
<html>
<head>
<META http-equiv=Content-Type content="text/html;charset=GBK">
<title>打印测试</title>
</head><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 RegWsh = new ActiveXObject("WScript.Shell")
hkey_key="header"
RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"")
hkey_key="footer"
RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"")
}catch(e){}
}
//设置网页打印的页眉页脚为默认值
function pagesetup_default(){
try{
var RegWsh = new ActiveXObject("WScript.Shell")
hkey_key="header"
RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"")
hkey_key="footer"
RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"第 &p 页/共 &P 页&b&d")
}catch(e){}
}
</script><style media="print">.Noprint {
DISPLAY: none
}
</style><body onload="pagesetup_default()">
<table id="toolbar" cellpadding="0" cellspacing="0" align="center" width="96%" class="noprint">
<tr>
<td width="640" height="30" valign="middle">
<OBJECT id=WebBrowser classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 width=0></OBJECT>
<input type=button value=打印 onclick="document.all.WebBrowser.ExecWB(6,1)">
<input type=button value=页面设置 onclick="document.all.WebBrowser.ExecWB(8,1)">
<input type=button value=打印预览 onclick="document.all.WebBrowser.ExecWB(7,1)">
<input type="button" value="退出" onclick="javascript:window.close();">
</td>
</tr>
</table>
<table width="95%" border="0" align="center" cellpadding="8" cellspacing="0">
<tr>
<td valign="top">打印测试</td>
</tr>
</table>
</body>
</html>---------------------------------------------------------------------
将不需要显示的部分的class设置为Noprint即可。