如何通过JS打印WEB页面上的一个DIV 问题是这样的:WEB页面有多个DIV,按照业务需求,我只需要打印其中一个DIV里的内容,各位JS前辈,有好的解决方法吗? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 和lodop打印控件吧,很好用,而且是免费的,我最近弄个项目要打印也是用的这控件 <HTML><HEAD><TITLE>Test Printer</TITLE><script language=javascript>///////////////////////BGN::printer language::BGN///////////////////////function SetPrintSettings(){//控制"纵打、 横打、页面的边距"。 // -- advanced features factory.printing.SetMarginMeasure(2) // measure margins in inches factory.SetPageRange(false, 1, 3) // need pages from 1 to 3 factory.printing.printer = "Panasonic KX-P1121" factory.printing.copies = 2 factory.printing.collate = true factory.printing.paperSize = "A4" factory.printing.paperSource = "Manual feed" // -- basic features factory.printing.header = false factory.printing.footer = false factory.printing.portrait = false factory.printing.leftMargin = 1.0 factory.printing.topMargin = 1.0 factory.printing.rightMargin = 1.0 factory.printing.bottomMargin = 1.0}function printsetup(){// 打印页面设置 wb.ExecWB(8,1);}function printpreview(){// 打印页面预览 t.style.display='none'; wb.ExecWB(7,1); t.style.display='block';}function printExec(){//开始打印 wb.ExecWB(6,6)}function beginPrint(){ t.style.display='none'; printExec(); t.style.display='block';}function freshWin(){ wb.ExecWB(22,1);}function closeWin(){ //window.opener=null; window.close();}///////////////////////BGN::printer language::BGN///////////////////////</script></HEAD><STYLE><!--A:link {text-decoration:none; color:black;}A:visited {text-decoration:none; color:black;}A:hover { text-decoration:none; color:brown;}p,br,body,td,table,tr {color:black; font-size:9pt;}--></STYLE><BODY style="margin:0"><TABLE WIDTH='100%' CELLSPACING=1 CELLPADDING=1 BORDER=0><TR BGCOLOR='#D6D39C' HEIGHT=23 ALIGN=CENTER><TD>产品编号</TD><TD>购买商品</TD><TD>供货商</TD><TD>价格</TD><TD>数量</TD><TD>合计/分数</TD><td>修改</td></TR></table><p>大大大大大大大大大大大大大大大大大大在</p><!------------------------------------BGN::隐藏的打印层----------------------------------------------><!------------------------------------BGN::隐藏的打印层----------------------------------------------><!------------------------------------BGN::隐藏的打印层----------------------------------------------><!------------------------------------BEGIN::打印功能控件--------------------------------------------> <OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height=0 id=wb name=wb width=0> </OBJECT> <!------------------------------------END ::打印功能控件--------------------------------------------><center><div id='t' style='cneter' ><br><input type=button name=button_print value="开始打印" onclick="beginPrint()"><input type=button name=button_setup value="页面设置" onclick="printsetup();"><input type=button name=button_show value="打印预览" onclick="printpreview();"><input type=button name=button_fh value="刷新本页" onclick="freshWin()"><input type=button onClick="closeWin()" value="关 闭"><br></div></center><!------------------------------------END::隐藏的打印层----------------------------------------------><!------------------------------------END::隐藏的打印层----------------------------------------------><!------------------------------------END::隐藏的打印层----------------------------------------------></BODY></HTML> 关于js navigator.userAgent 的问题 如何动态改变class中的内容 寻求用户可以自动排版的JS代码.给100分 javascript中的枚举类型? 横向滚动的怎样实现?采用scrollLeft与scrollWidth定位 javascript加都会出错。怎么回事? 怎样实现alert()中文字编辑?急... 关于更改页面本身的宽度问题,能实现吗? 在一个页面中有“打印”连接,如果点击此连接打印页面啊 怎么样做到,点一下[全选],所有的[单选框]全部给选上 reset 控制 display 显示隐藏 请问,如何在两个表格之间移动行并能用托懂行的办法在表内排序
<HEAD>
<TITLE>Test Printer</TITLE><script language=javascript>///////////////////////BGN::printer language::BGN///////////////////////
function SetPrintSettings()
{//控制"纵打、 横打、页面的边距"。 // -- advanced features
factory.printing.SetMarginMeasure(2) // measure margins in inches
factory.SetPageRange(false, 1, 3) // need pages from 1 to 3 factory.printing.printer = "Panasonic KX-P1121"
factory.printing.copies = 2
factory.printing.collate = true
factory.printing.paperSize = "A4"
factory.printing.paperSource = "Manual feed" // -- basic features
factory.printing.header = false
factory.printing.footer = false
factory.printing.portrait = false
factory.printing.leftMargin = 1.0
factory.printing.topMargin = 1.0
factory.printing.rightMargin = 1.0
factory.printing.bottomMargin = 1.0
}function printsetup()
{// 打印页面设置
wb.ExecWB(8,1);
}
function printpreview()
{// 打印页面预览
t.style.display='none';
wb.ExecWB(7,1);
t.style.display='block';
}function printExec()
{//开始打印
wb.ExecWB(6,6)
}function beginPrint()
{
t.style.display='none';
printExec();
t.style.display='block';
}function freshWin()
{
wb.ExecWB(22,1);
}function closeWin()
{
//window.opener=null;
window.close();
}///////////////////////BGN::printer language::BGN///////////////////////
</script></HEAD>
<STYLE>
<!--
A:link {text-decoration:none; color:black;}
A:visited {text-decoration:none; color:black;}
A:hover { text-decoration:none; color:brown;}
p,br,body,td,table,tr {color:black; font-size:9pt;}
-->
</STYLE><BODY style="margin:0">
<TABLE WIDTH='100%' CELLSPACING=1 CELLPADDING=1 BORDER=0>
<TR BGCOLOR='#D6D39C' HEIGHT=23 ALIGN=CENTER>
<TD>产品编号</TD>
<TD>购买商品</TD>
<TD>供货商</TD>
<TD>价格</TD>
<TD>数量</TD>
<TD>合计/分数</TD>
<td>修改</td>
</TR>
</table><p>大大大大大大大大大大大大大大大大大大在</p><!------------------------------------BGN::隐藏的打印层---------------------------------------------->
<!------------------------------------BGN::隐藏的打印层---------------------------------------------->
<!------------------------------------BGN::隐藏的打印层----------------------------------------------><!------------------------------------BEGIN::打印功能控件--------------------------------------------> <OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height=0 id=wb name=wb width=0>
</OBJECT>
<!------------------------------------END ::打印功能控件--------------------------------------------><center>
<div id='t' style='cneter' >
<br>
<input type=button name=button_print value="开始打印" onclick="beginPrint()">
<input type=button name=button_setup value="页面设置" onclick="printsetup();">
<input type=button name=button_show value="打印预览" onclick="printpreview();">
<input type=button name=button_fh value="刷新本页" onclick="freshWin()">
<input type=button onClick="closeWin()" value="关 闭">
<br>
</div>
</center>
<!------------------------------------END::隐藏的打印层---------------------------------------------->
<!------------------------------------END::隐藏的打印层---------------------------------------------->
<!------------------------------------END::隐藏的打印层----------------------------------------------></BODY>
</HTML>