//---------------------------------------------------------- // 通用打印 //---------------------------------------------------------- function commonprint(title,divId,cardNo,branchName,width,height){ //alert("HELLO"); var sarg=new Array(); var sdata=document.all.item(divId); sarg[0]=title; text = sdata.outerHTML; text = text.replace(/border=[^[1|\s]]*([\s|>])/ig,"border=1 style='border-collapse:collapse' bordercolor='#000000'$1"); text = text.replace(/cellSpacing=[^[0|\s]]*([\s|>])/ig,"$1"); text = text.replace(/cellPadding=[^[0|\s]]*([\s|>])/ig,"$1"); text = text.replace(/<TABLE/ig,"<TABLE cellSpacing=0 cellPadding=0");
http://hi.baidu.com/myworld_wang/blog/item/55b5b744103ebb83b2b7dc11.html
<input type=button value=打印 onclick="document.all.WebBrowser.ExecWB(6,1)">
<input type=button value=直接打印 onclick="document.all.WebBrowser.ExecWB(6,6)">
<input type=button value=页面设置 onclick="document.all.WebBrowser.ExecWB(8,1)">
<input type=button value=打印预览 onclick="document.all.WebBrowser.ExecWB(7,1)">
求meadco中文手册。
// 通用打印
//----------------------------------------------------------
function commonprint(title,divId,cardNo,branchName,width,height){
//alert("HELLO");
var sarg=new Array();
var sdata=document.all.item(divId);
sarg[0]=title;
text = sdata.outerHTML;
text = text.replace(/border=[^[1|\s]]*([\s|>])/ig,"border=1 style='border-collapse:collapse' bordercolor='#000000'$1");
text = text.replace(/cellSpacing=[^[0|\s]]*([\s|>])/ig,"$1");
text = text.replace(/cellPadding=[^[0|\s]]*([\s|>])/ig,"$1");
text = text.replace(/<TABLE/ig,"<TABLE cellSpacing=0 cellPadding=0");
sarg[1]=text;
sarg[2]=cardNo;
sarg[3]=branchName;
//alert(test);
//alert(sarg[1]);
window.showModalDialog("print.jsp",sarg,"dialogWidth:"+width+"px;dialogHeight:"+height+"px;center:yes;help:no;status:no;resizable:yes");
return;
}