62,254
社区成员
发帖
与我相关
我的任务
分享
//使用DIV。参考:
<HTML>
<HEAD>
<title>打印行程单</title>
<style type="text/css"> .STYLE1 { COLOR: #ff0000 } </style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<!--media=print 这个属性可以在打印时有效-->
<style media="print"> .Noprint { DISPLAY: none }
.PageNext { PAGE-BREAK-AFTER: always } </style>
<script>
//按钮事件
var directPrint = function(){
pagesetup_null();
var div =document.getElementById("wsp");
var div1 =document.getElementById("pt");
div.style.display="";
div1.style.display="none";
document.all.WebBrowser.ExecWB(6,6);
div.style.display="none";
div1.style.display="";
}
//设置网页打印的页眉页脚为空
function pagesetup_null(){
var hkey_root,hkey_path,hkey_key;
hkey_root="HKEY_CURRENT_USER"
hkey_path="\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";
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 Valid()
{
if(document.getElementById(<%="'" + this.TextBox1.ClientID + "'"%>).value=="")
{
alert("电子客票号码不能为空!");
return false;
}
return true;
}
function Valid1()
{
if(document.getElementById(<%="'" + this.TextBox1.ClientID + "'"%>).value=="")
{
alert("电子客票号码不能为空!");
return false;
}
return true;
}
</script>
</HEAD>
<body>
<form id="WebPrint" method="post" runat="server">
<table class="Noprint" width="98%" border="0" height=25 bordercolor="#000033" style="WIDTH:780px;">
<tr >
<td width=90 style="font-size: 9pt">电子客票号码:</td>
<td width=90 style="font-size: 9pt"><asp:DropDownList ID="TextBox1" Height=25 width=125 runat="server" AutoPostBack="True" OnSelectedIndexChanged="TextBox1_SelectedIndexChanged"></asp:DropDownList></td>
<td> <asp:Button ID="LinkButton1" runat="server" OnClick="LinkButton1_Click1" Width=90 style="font-size: 9pt" Text="创建行程单信息" ></asp:Button>
<asp:Button ID="LinkButton2" runat="server" OnClick="LinkButton2_Click1" Width=80 style="font-size: 9pt" Text="作废行程单" OnClientClick="return confirm('您确定要取消行程单吗?')"></asp:Button>
<input type=button name="打印" value="打印" style="font-size: 9pt; min-width:15px; min-height:10px" onclick="directPrint()" id="Button1" />
</td>
<td>
<OBJECT id=WebBrowser classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 width=0>
</OBJECT>
</td>
<td width=200></td>
</tr>
</table>
<div id="wsp" style="display:none">
<table id="Table4" width="730" height="280" border="0" cellpadding="5" cellspacing="5">
<tr>
<td width="931">
<div id="Div1" style="Z-INDEX:101;font-size:12pt;LEFT:441px;WIDTH:272px; POSITION:absolute; TOP:11px; HEIGHT:20px"
align="left" ><%=Vise%></div>
<div id="Div6" style="Z-INDEX:110;font-size:12pt;LEFT:80px; WIDTH:136px; POSITION:absolute; TOP:223px; HEIGHT:20px"
align="left"><%=Tel%></div>
<table ID="Table5" width="98%" cellpadding="3" align="LEFT" style="Z-INDEX:100;font-size:12pt; LEFT:53px; WIDTH:690px; POSITION:absolute; TOP:65px">
<%=Text%>
</table>
<div id="Div7" style="Z-INDEX:113; LEFT:80px; font-size:12pt; font-family:WIDTH:120px; POSITION:absolute; TOP:248px; HEIGHT:20px; width: 119px;"
align="left"><%=Code%></div>
<div id="Div8" style="Z-INDEX:112; LEFT:272px;font-size:12pt; WIDTH:296px; POSITION:absolute; TOP:254px; HEIGHT:20px"
align="left"><%=Company%></div>
<div id="Div9" align="left" style="Z-INDEX:106; font-size:12pt;LEFT:690px; WIDTH:55px; POSITION:absolute; TOP:228px; HEIGHT:20px"><%=Safety%></div>
<div id="Div10" align="left" style="Z-INDEX:101;font-size:12pt; LEFT:201px; WIDTH:203px; POSITION:absolute; TOP:11px; HEIGHT:20px;"><%=Idec%></div>
<div id="Div11" style="Z-INDEX:111; LEFT:256px; font-size:12pt;WIDTH:67px; POSITION:absolute; TOP:221px; HEIGHT:19px"
align="left"><%=Verify%></div>
<div id="Div12" align="left" style="Z-INDEX:101;font-size:12pt; LEFT:21px; WIDTH:183px; POSITION:absolute; TOP:11px; HEIGHT:20px"><%=Name%></div>
<div id="Div13" align="left" style="Z-INDEX:107;font-size:12pt; LEFT:416px; WIDTH:200px; POSITION:absolute; TOP:221px; HEIGHT:20px"><%=Kep%></div>
<div id="Div14" align="left" style="Z-INDEX:108; font-size:12pt;LEFT:632px; WIDTH:96px; POSITION:absolute; TOP:254px; HEIGHT:20px"><%=Date%></div>
<table width="98%" align="center" style="Z-INDEX:103; LEFT:164px; WIDTH:556px; POSITION:absolute; TOP:197px; HEIGHT:21px"
ID="Table6">
<tr>
<td width="100" align="left" height="20" style="font-size: 12pt"><%=Fare%></td>
<td width="100" height="20" align="left" style="font-size: 12pt"><%=JcFare%></td>
<td height="20" width="108" align="left" style="font-size: 12pt"><%=RyFare%></td>
<td height="20" width="94" align="left" style="font-size: 12pt"><%=Rest%></td>
<td height="20" width="132" align="left" style="font-size: 12pt"><%=Total%></td>
</tr>
</table>
<div id="Div15" align="center" style="Z-INDEX:105; LEFT:21px; WIDTH:88px;font-size: 12pt; POSITION:absolute; TOP:39px; HEIGHT:20px"><%=Pnr%></div>
<div id="Div16" style="Z-INDEX:113; LEFT:79px; font-size:12pt;WIDTH:120px; POSITION:absolute; TOP:267px; HEIGHT:20px"
align="left"><%=Hxh%></div></td>
</tr>
</table>
</div>
</form>
</body>
</HTML>