87,917
社区成员
发帖
与我相关
我的任务
分享
//参考;
<%@ Control Language="c#" AutoEventWireup="false" Inherits="FLX.Portal.PageModeTemplate" %>
<style type="text/css">
<!--
.STYLE1 {color: #FF0000}
-->
</style>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<!--media=print 这个属性可以在打印时有效-->
<style media=print>
.Noprint{display:none;}
.PageNext{page-break-after: always;}
</style>
<style>
.tdp
{
border-bottom: 1 solid #000000;
border-left: 1 solid #000000;
border-right: 0 solid #ffffff;
border-top: 0 solid #ffffff;
}
.tabp
{
border-color: #000000 #000000 #000000 #000000;
border-style: solid;
border-top-width: 2px;
border-right-width: 2px;
border-bottom-width: 1px;
border-left-width: 1px;
}
.NOPRINT {
font-family: "宋体";
font-size: 9pt;
}
</style>
<script>
function QueryString(sName)
{
var sSource = String(window.document.location);
var sReturn = "";
var sQUS = "?";
var sAMP = "&";
var sEQ = "=";
var iPos;
iPos = sSource.indexOf(sQUS);
var strQuery = sSource.substr(iPos, sSource.length - iPos);
var strLCQuery = strQuery.toLowerCase();
var strLCName = sName.toLowerCase();
iPos = strLCQuery.indexOf(sQUS + strLCName + sEQ);
if (iPos == -1)
{
iPos = strLCQuery.indexOf(sAMP + strLCName + sEQ);
if (iPos == -1)
return "";
}
sReturn = strQuery.substr(iPos + sName.length + 2,strQuery.length-(iPos + sName.length + 2));
var iPosAMP = sReturn.indexOf(sAMP);
if (iPosAMP == -1)
return sReturn;
else
{
sReturn = sReturn.substr(0, iPosAMP);
}
return sReturn;
}
var PrintFirst = function(){
window.location.href = window.location.href
.replace(/\?PageIndex=(\d)*$/g,"").replace(/\?PageIndex=(\d)*&/g,"?").replace(/&PageIndex=(\d)*&/g,"&").replace(/&PageIndex=(\d)*$/g,"")
+"&PageIndex=1";
}
var PrintLast = function(){
var last = QueryString('LastPage');
window.location.href = window.location.href
.replace(/\?PageIndex=(\d)*$/g,"").replace(/\?PageIndex=(\d)*&/g,"?").replace(/&PageIndex=(\d)*&/g,"&").replace(/&PageIndex=(\d)*$/g,"")
+"&PageIndex="+last;
}
var PrintPre = function(){
var index = QueryString('PageIndex');
if(index>1)
window.location.href = window.location.href
.replace(/\?PageIndex=(\d)*$/g,"").replace(/\?PageIndex=(\d)*&/g,"?").replace(/&PageIndex=(\d)*&/g,"&").replace(/&PageIndex=(\d)*$/g,"")
+"&PageIndex="+(index-1);
else alert("到头了");
}
var PrintNext = function(){
var index = parseInt(QueryString('PageIndex'));
var last = parseInt(QueryString('LastPage'));
if((index+1)<=last)
window.location.href = window.location.href
.replace(/\?PageIndex=(\d)*$/g,"").replace(/\?PageIndex=(\d)*&/g,"?").replace(/&PageIndex=(\d)*&/g,"&").replace(/&PageIndex=(\d)*$/g,"")
+"&PageIndex="+(index+1);
else alert("到头了");
}
//创建按钮
var createButton = function(vID,vValue,eventHandler){
var div =document.getElementById("div1");
var btnButton = document.createElement("INPUT");
btnButton.type ="Button";
btnButton.id = vID;
btnButton.value = vValue;
btnButton.onclick = eventHandler;
div.appendChild(btnButton);
}
//创建标签
var createSpan = function(vID,vValue,eventHandler){
var div =document.getElementById("div1");
var htmSpan = document.createElement("span");
htmSpan.id = vID;
htmSpan.innerHTML = vValue;
if(eventHandler != null)
htmSpan.onclick = eventHandler;
div.appendChild(htmSpan);
}
//按钮事件
var print = function(){
pagesetup_null();
document.all.WebBrowser.ExecWB(6,1);
}
var directPrint = function(){
pagesetup_null();
document.all.WebBrowser.ExecWB(6,6);
}
var PrintSetUp = function(){
pagesetup_null();
document.all.WebBrowser.ExecWB(8,1);
}
var PrintReview = function(){
pagesetup_null();
document.all.WebBrowser.ExecWB(7,1);
}
window.onload = function(){
createButton("btn0","打印",print);
createButton("btn1","直接打印",directPrint);
createButton("btn2","页面设置",PrintSetUp);
createButton("btn3","打印预览",PrintReview);
createButton("btn4","首 页",PrintFirst);
createButton("btn5","上一页",PrintPre);
createButton("btn6","下一页",PrintNext);
createButton("btn7","末 页",PrintLast);
var index =QueryString('PageIndex');
var last = QueryString('LastPage');
createSpan("span0"," 当前第 "+index+"/"+last+" 页 ",null);
}
//设置网页打印的页眉页脚为空
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){}
}
</script>
</head>
<body >
<center class="Noprint" >
<p>
<OBJECT id=WebBrowser classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 width=0>
</OBJECT>
<div id="div1">
</div>
</p>
</center>
<div class="page">
<table id="Table_01" width="780" height="360" border="0" cellpadding="0" cellspacing="0" background="行程单.JPG">
<tr><td width="931" style="position:relative; padding:inherit; "><div id="Layer2" align="center" style="position:absolute;
left:57px; top:98px; width:55px; height:20px; z-index:2;">FEKPO</div>
<div id="Layer6" style="position:absolute; left:450px; top:72px; width:119px; height:23px; z-index:6;
vertical-align:middle" align="center">一星期内有效</div>
<div id="Layer9" style="position:absolute; left:95px; top:276px; width:153px; height:24px; z-index:9;"
align="left">7188881131464</div>
<table width="98%" align="center" runat="server" height="" style="position:absolute; top:134px; left: 62px; width: 686px;">
<tr>
<td width="106" align="left" height="20" >北京 FOR </td>
<td width="54" height="20" align="center" >方中信</td>
<td width="40" height="20" align="center" >C10</td>
<td height="20" width="44" align="center" >A级</td>
<td height="20" width="65" align="center" >2008-03-21</td>
<td height="20" width="34" align="center" >09:00</td>
<td height="20" width="147" align="center" >高级/高等</td>
<td height="20" width="57" align="center" >2008-03-21</td>
<td height="20" width="55" align="center" >2008-03-27</td>
<td height="20" width="40" >无任何行李</td>
</tr>
</table>
<div id="Layer10" style="position:absolute; left:98px; top:314px; height:19px; z-index:10; width: 62px;" align="center">086</div>
<div id="layer9" style="position:absolute; left:247px; top:315px; height:18px; z-index:10; width: 260px;" align="center">纵横天地电子商旅公司</div>
<div id="layer" align="center" style="position:absolute; left:684px; top:273px; width:63px; height:24px;
z-index:2;">40.00¥</div>
<div id="layer2" align="left" style="position:absolute; left:203px; top:73px; width:203px; height:20px; z-
index:2;">43453453</div>
<div id="layer3" style="position:absolute; left:272px; top:281px; height:19px; z-index:10; width: 67px;" align="center">APKS</div>
<div id="layer4" align="center" style="position:absolute;
left:57px; top:72px; width:55px; height:20px; z-index:2;">方信</div>
<div id="layer5" align="center" style="position:absolute; left:403px; top:277px; width:55px; height:24px;
z-index:2;">无</div>
<div id="layer6" align="center" style="position:absolute; left:643px; top:308px; width:85px; height:24px;
z-index:2;">2008-03-21</div>
<table width="98%" align="center" runat="server" height="" style="position:absolute; top:252px; left: 190px; width: 556px; height: 21px;">
<tr>
<td width="102" align="left" height="20" >1000.00¥</td>
<td width="91" height="20" align="center" >90.00¥</td>
<td height="20" width="90" align="center" >70.00¥</td>
<td height="20" width="100" align="center" >40.00¥</td>
<td height="20" width="149" align="center" >1200.00¥</td>
</tr>
</table></td></tr>
</table>
</div>
</body>
</html>