欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

JS調(diào)用打印機(jī)功能簡(jiǎn)單示例

 更新時(shí)間:2016年11月28日 11:27:05   作者:巴霍巴利  
這篇文章主要介紹了JS調(diào)用打印機(jī)功能的方法,結(jié)合完整實(shí)例形式分析了javascript打印機(jī)功能的相關(guān)設(shè)置與使用技巧,需要的朋友可以參考下

本文實(shí)例講述了JS調(diào)用打印機(jī)功能的方法。分享給大家供大家參考,具體如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><!--{$aListData.name}-->準(zhǔn)考證</title>
<input id="btnPrint" type="button" value="打印" onclick="javascript:window.print();" />
<input id="btnPrint" type="button" value="打印預(yù)覽" onclick=preview(1) />
<style type="text/css" media=print>
.noprint{display : none }
</style>
<script>
function preview(oper)
{
if (oper < 10)
{
bdhtml=window.document.body.innerHTML;//獲取當(dāng)前頁(yè)的html代碼
sprnstr="<!--startprint"+oper+"-->";//設(shè)置打印開(kāi)始區(qū)域
eprnstr="<!--endprint"+oper+"-->";//設(shè)置打印結(jié)束區(qū)域
prnhtml=bdhtml.substring(bdhtml.indexOf(sprnstr)+18); //從開(kāi)始代碼向后取html
prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));//從結(jié)束代碼向前取html
window.document.body.innerHTML=prnhtml;
window.print();
window.document.body.innerHTML=bdhtml;
} else {
window.print();
}
}
</script>
<script type="text/javascript" src="/js/jquery-1.4.2.min.js"></script>
<script>
jQuery(function($){
 $("#closeButton").click(function(){
    window.close();
 })
});
</script>
</head>
<body>
<a id='closeButton' title='Close' href="#" >關(guān)閉</a>
<!-- 打印startprint與endprint之間的內(nèi)容-->
<!--startprint1-->
<h1>南京聾人高級(jí)中學(xué)2013年預(yù)科招生考試</h1>
姓名:<!--{$aListData.name}--><br/>
性別:<!--{$aListData.gender}--><br/>
畢業(yè)學(xué)校:<!--{$aListData.grschool}--><br/>
編號(hào):<input type="text" name="sturegcard" class="input1 ml10" value="<!--{$aListData.sturegcard}-->"/><br/>
頭像:<img src="<!--{$aListData.avatar}-->" width="140"><br/>
考試日程:<br/>
地點(diǎn):<br/>
<!--{if $aRegExamsche}-->
  <!--{section name=data loop=$aRegExamsche}-->
    <!--{$aRegExamsche[data].date}-->
    <!--{$aRegExamsche[data].time}-->
    <!--{$aRegExamsche[data].lesson}-->
    <!--{$aRegExamsche[data].place}--><br/>
  <!--{/section}-->
<!--{/if}-->
<!--endprint1-->
</body>
</html>

更多關(guān)于JavaScript相關(guān)內(nèi)容感興趣的讀者可查看本站專(zhuān)題:《JavaScript中json操作技巧總結(jié)》、《JavaScript切換特效與技巧總結(jié)》、《JavaScript查找算法技巧總結(jié)》、《JavaScript動(dòng)畫(huà)特效與技巧匯總》、《JavaScript錯(cuò)誤與調(diào)試技巧總結(jié)》、《JavaScript數(shù)據(jù)結(jié)構(gòu)與算法技巧總結(jié)》、《JavaScript遍歷算法與技巧總結(jié)》及《JavaScript數(shù)學(xué)運(yùn)算用法總結(jié)

希望本文所述對(duì)大家JavaScript程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論