blg_统考,打印准考证 网页代码!

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>打印准考证</title>
</head>
<body style="text-align: left; font-size: 10pt">
<div style="text-align: center; font-weight: bold; font-size: 12pt; color: blue;">
打印须知
</div>
<div style="text-align: left">
<ol style="line-height: 22px">
<li>建议使用IE8,9,10,11,Firefox,360兼容模式打开。
<br />360兼容模式打开方法如下:<br />
<img src="data/360.png" /></li>
<li>打开下面各准考证链接,在弹出的页面中依次选择菜单:“文件 》打印预览”,弹出打印预览窗口。</li>
<li>在打印预览窗口中点击左上角工具栏里的页面设置按钮(小齿轮图标),弹出页面设置对话框。 </li>
<li>页面设置: (一般情况下,浏览器默认的页面设置即为如下设置)
<table style="font-size: 9pt; border-collapse: collapse" border="1px">
<tr>
<td style="width: 65px; height: 21px" align="center">
纸张大小</td>
<td style="width: 63px; height: 21px" align="center">
页眉和页脚</td>
<td style="width: 79px; height: 21px" align="center">
方向</td>
<td style="width: 264px; height: 21px" align="center">
页边距</td>
</tr>
<tr>
<td style="width: 65px; height: 18px;" align="center">
<span style="color: #ff0000">A4</span></td>
<td style="width: 63px; height: 18px;" align="center">
<span style="color: #ff0000">空</span></td>
<td style="width: 79px; height: 18px;" align="center">
<span style="color: #ff0000">纵向</span></td>
<td style="width: 264px; height: 18px;" align="center">
<span style="color: #ff0000">上下左右均为 19.05 毫米(或 0.75 英寸)</span></td>
</tr>
</table>
</li>
<li>确定设置后,可打印。</li>
</ol>
</div>
<div style="text-align: center">
<a target='_blank' href='data\ExamCards_1.xml'>准考证_1</a><br/>
</div>
<br />
<div style="margin: 20">
证件号:<input id="txtIDNumber" type="text" /><input id="btnQuery" type="button" value="查询"
onclick="btnQuery_click()" />
</div>
<div style="text-align: left; font-weight:bold; font-size: 18pt; color:green;">
赵老师提醒您:
<br />
请注意,姓名不唯一,打开后请仔细核对是否本人!!
</div>
<br />
<div style="margin: 20; font-weight: bold;font-size: 14pt; color: red;">
姓 名:<input id="txtIDNumber1" type="text" /><input id="btnQuery1" type="button" value="查询"

onclick="btnQuery1_click()" />

</div>
</body>
</html>

<script type="text/javascript" language="javascript">
function btnQuery_click()
{
if(!txtIDNumber.value && txtIDNumber.value=="")
{
alert("请输入证件号码!");
return;
}
var xslDoc = new ActiveXObject('Microsoft.XMLDOM');
var xmlDoc = new ActiveXObject('Microsoft.XMLDOM');
var xmlDocSearch = new ActiveXObject('Microsoft.XMLDOM');

if(xslDoc && xmlDoc && xmlDocSearch)
{
xslDoc.async = false;
xmlDoc.async =false;
xmlDocSearch.async =false;

if(!xslDoc.load("data/ExamCards.xsl"))
{
alert("载入解析文件出错!");
}

var nodeSearch= null;
var i=1;
var rootNode = xmlDocSearch.createElement("UnitsExamCards");
while( !nodeSearch && xmlDoc.load("data/ExamCards_"+i+".xml"))
{
var re =/^\s+|\s+$/g;
var certificatecode = txtIDNumber.value.replace(re,"");
var nodeSearch = xmlDoc.selectSingleNode("UnitsExamCards/ExamCard[CertificateCode='"+certificatecode+"']");
if(nodeSearch)
{
var node = nodeSearch.childNodes.item(8);
node.text = "data/" + node.text;

rootNode.appendChild(nodeSearch);
xmlDocSearch.appendChild(rootNode);

document.write(xmlDocSearch.transformNode(xslDoc));
return;
}
i++;
}
if(!nodeSearch) alert("没找到匹配的考生准考证!");
}
else
alert("创建ActiveXObject时出错!");

}
function btnQuery1_click()
{
if(!txtIDNumber1.value && txtIDNumber1.value=="")
{
alert("赵老师提醒您 :请输入姓名");
return;
}
var xslDoc = new ActiveXObject('Microsoft.XMLDOM');
var xmlDoc = new ActiveXObject('Microsoft.XMLDOM');
var xmlDocSearch = new ActiveXObject('Microsoft.XMLDOM');

if(xslDoc && xmlDoc && xmlDocSearch)
{
xslDoc.async = false;
xmlDoc.async =false;
xmlDocSearch.async =false;

if(!xslDoc.load("data/ExamCards.xsl"))
{
alert("载入解析文件出错!");
}

var nodeSearch= null;
var i=1;
var rootNode = xmlDocSearch.createElement("UnitsExamCards");
while( !nodeSearch && xmlDoc.load("data/ExamCards_"+i+".xml"))
{
var re =/^\s+|\s+$/g;
var studentname= txtIDNumber1.value.replace(re,"");
var nodeSearch = xmlDoc.selectSingleNode("UnitsExamCards/ExamCard[StudentName='"+studentname+"']");
if(nodeSearch)
{
var node = nodeSearch.childNodes.item(8);
node.text = "data/" + node.text;

rootNode.appendChild(nodeSearch);
xmlDocSearch.appendChild(rootNode);

document.write(xmlDocSearch.transformNode(xslDoc));
return;
}
i++;
}
if(!nodeSearch) alert(" 赵老师提醒您 :没找到匹配的考生姓名!");
}
else
alert("创建ActiveXObject时出错!");

}

 

</script>

posted @ 2016-04-11 00:55  大白熊^_^  阅读(2778)  评论(0编辑  收藏  举报