web页é¢æå°æ两ç§ï¼ä¸ç§æ¯ç´æ¥è°ç¨window.print()å½ä»¤æä½ï¼ä¸ç§æ¯ä½¿ç¨ActiveXæ件ï¼Objectæ ç¾ï¼æä½ï¼ä½æ¯ç¬¬äºç§åªæ¯æIEå æ ¸çæµè§å¨ã
示ä¾1ï¼
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>æå°01</title>
</head>
<script src="./jquery.min.js" type="text/javascript"></script>
<body>
<!-- <h1>æå°æå§ï¼ï¼ï¼</h1>
<button id="print1">æå°å
¨é¨</button> -->
<p>ä¸é¢æ¯ç¾åº¦çå¾ç</p>
<div>
<!--startprint-->
<img src="./imgs/baidu.png">
<!--endprint-->
</div>
<button id="print1">æå°å
¨é¨</button>
<button id="print2" οnclick="doPrint()">æå°æå®é¨å(以æå°å¾ç为ä¾)</button>
<button id="print3">æå°é¤æé¨åä¹å¤ççé¨å</button>
</body>
<script type="text/javascript">
// æ´ä½æå°
// æå°å
容为window.document.body.innerHTMLçå¯è§å
容
$('#print1').click(function(){
window.print();
});
// å±é¨æå°
function doPrint() {
var bdhtml = window.document.body.innerHTML;
var sprnstr = "<!--startprint-->"; //å¼å§æå°æ è¯å符串æ17个å符
var eprnstr = "<!--endprint-->"; //ç»ææå°æ è¯å符串
var prnhtml = bdhtml.substr(bdhtml.indexOf(sprnstr) + 17); //ä»å¼å§æå°æ è¯ä¹åçå
容
prnhtml = prnhtml.substring(0, prnhtml.indexOf(eprnstr)); //æªåå¼å§æ è¯åç»ææ è¯ä¹é´çå
容
window.document.body.innerHTML = prnhtml; //æéè¦æå°çæå®å
容èµç»body.innerHTML
window.print(); //è°ç¨æµè§å¨çæå°åè½æå°æå®åºå
window.document.body.innerHTML = bdhtml; // æåè¿å页é¢
}
// æå°æå®å
容以å¤çé¨å
$('#print3').click(function () {
$('p').hide();
window.print();
$('p').show();
});
</script>
</html>
示ä¾2ï¼
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>æå°02</title>
<style>
@media print{
ãã.noprint{
ããdisplay:none
ãã}
}
</style>
</head>
<script>
function printsetup() {
// æå°é¡µé¢è®¾ç½®
wb.execwb(8, 1);
}
function printpreview() {
// æå°é¡µé¢é¢è§
wb.execwb(7, 1);
}
function printit() {
if (confirm('ç¡®å®æå°åï¼')) {
wb.ExecWB(6, 1)
//wb.execwb(1,1)//æå¼
//wb.ExecWB(2,1);//å
³éç°å¨ææçIEçªå£ï¼å¹¶æå¼ä¸ä¸ªæ°çªå£
//wb.ExecWB(4,1)//;ä¿åç½é¡µ
//wb.ExecWB(6,1)//æå°
//wb.ExecWB(7,1)//æå°é¢è§
//wb.ExecWB(8,1)//æå°é¡µé¢è®¾ç½®
//wb.ExecWB(10,1)//æ¥ç页é¢å±æ§
//wb.ExecWB(15,1)//好åæ¯æ¤éï¼æå¾
确认
//wb.ExecWB(17,1)//å
¨é
//wb.ExecWB(22,1)//å·æ°
//wb.ExecWB(45,1)//å
³éçªä½æ æ示
}
}
</script>
<body>
<div class="noprint" style="width:640px;height:20px;margin:100px auto 0 auto;font-size:12px;text-align:right;">
<input value="æå°" type="button" οnclick="javascript:window.print()" />
<!-- åªæIEæµè§å¨ææ¯æ -->
<OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height="0" id="wb" name="wb" width="0">
</OBJECT>
<input type=button name=button_print style="display:none;" value="æå°æ¬åæ®" οnclick="javascript:printit()">
<input type=button name=button_setup value="æå°é¡µé¢è®¾ç½®" οnclick="javascript:printsetup();">
<input type=button name=button_show value="æå°é¢è§" οnclick="javascript:printpreview();">
<input type=button name=button_fh value="å
³é" οnclick="javascript:window.close();">
</div>
<div style="width:640px;height:624px;margin:20px auto;">
<h1>ä½å¯æ°æ
</h1> ãã
<h3>ââå°æåè¿æè´«ç©·çå°æ¹éªä¸éç</h3> ãã
<p>ä¸å
乡ï¼å¯¿å®å¿æè¾¹è¿ç山乡ä¹ä¸ï¼1988å¹´æ建乡ï¼æ¾ç»æ¯"äºæ 乡é"(æ å
¬è·¯ãæ èªæ¥æ°´ãæ çµç¯ç
§æãæ è´¢æ¿æ¶å
¥ãæ æ¿åºåå
¬åºæ)ã</p> ãã
<p>1989å¹´7æ19æ¥ï¼æ¶ä»»å®å¾·å°å§ä¹¦è®°***带é¢å°ç´ç¸å
³é¨é¨è´è´£äººå¤´æ´è帽ï¼è©ææ¯å·¾ï¼é¡¶ççççæ¥ï¼å¨å´å²å±±è·¯ä¸è·æ¶2个å¤å°æ¶ï¼æ·±å
¥å°ä¹¡æ¿åºæå¨å°ä¸å
æã</p>
ãã<p>乡å
å§ãæ¿åºä¸´æ¶å¨é¸¾å³°æ¡¥è¾¹ççæ°ç¥ å éåå
¬ï¼æ¡ä»¶æå
¶ç®éï¼å¤§å®¶å°±å´åå¨å°æ¿å³ä¸å¼ä¼ãåé¥ãåä¼å°±å®æå¨é¸¾å³°æ¡¥ä¸ï¼åé¥åï¼ç¨ä½ä¼æ¯ï¼***åè¿æå
¥æ·ã访贫é®è¦ã</p> ãã
<p>åç¨ä»è¦æ¥è¡10å¤å
¬éï¼è·¯é©å¡é¡ï¼ä¸èæ£æèä¸çï¼***ä¸è¡æ¿çæ´åå°æ¡å¨è·¯é¢çèæ£ãèç§åé¤ãç´å°æä¸8ç¹å·¦å³ï¼ä»ä»¬æåå°å¯¿å®åå
³ã</p>
ãã<p>åå è°ç çæ¶ä»»å¯¿å®å¿å§å¸¸å§ã常å¡å¯å¿é¿è¿å¾·ä»å¨æ¥è®°ä¸åéï¼"è¿ä¸å¤©ï¼ä¹è½¦5个å°æ¶ï¼æ¥è¡4个åå°æ¶ï¼å¼ä¼åº§è°è®¿è´«2个å°æ¶ï¼ä¸è·¯é£å°ï¼å¤§æ±æ·æ¼ï¼è¾è¦ç¨åº¦ä¸è¨èå»â¦â¦åå°å¿åæå¾
æåï¼è®¸å¤å¹²é¨æåç°èåºãè趾é½ç£¨åºäºè¡æ³¡ã"</p> ãã
<p>***åå¿åæ¥ç¨"å¼å¸¸è°è¦ãå¼å¸¸é¾å¿"æ¥å½¢å®¹æ¤æ¬¡ä¸å
ä¹è¡ã1989å¹´7æ26æ¥ã1996å¹´8æ7æ¥ï¼ä»å两次æ¥å°ä¸å
ï¼åè°è§£å³å½å°ç建设åå±é¾é¢ã</p>
ãã<p>æ 论æ¯å¨å¦é¨ãå®å¾·ï¼è¿æ¯åæ¥ä¸»æ¿çä¼ç¦å·ãæ
ä»»çé¢å¯¼ï¼ç¾å§çå®å±å·æï¼***å§ç»è®°æå¨å¿ï¼è®¿è´«é®è¦æäºä»å·¥ä½ä¸ä¸å¯æ缺çä¸é¨åã"ä¸è¿ä¸å
乡"ï¼åªæ¯***å¿æç¾å§çä¸ä¸ªç¼©å½±ã</p> ãã
<p>æ
ä»»å¦é¨å¸å¯å¸é¿æé´ï¼***æ¾å管åä¸åæå·¥ä½ãä»æåºï¼å管åä¸ï¼é¦å
å°±æ¯è¦ä¸é«å±±ï¼ä¸æµ·å²ã</p>
ãã<p>å¦é¨å¸äººå¤§å¸¸å§ä¼åå¯ä¸»ä»»ãæ¶ä»»åå®å¿é¿éå®æ°è®°å¾ï¼æä¸æ¬¡ä»éªå***ä¸ä¹¡è°ç ï¼ææ¯ä¹¦è¯·ä»ä»¬åè¶ãç±äºé¿æ泡工夫è¶ï¼è¶æ¯ä¸é¢æè¶ç¢±ï¼çèµ·æ¥æç¹èï¼***端起æ¥å°±åã"è¿å»é¢å¯¼ä¸ä¹¡ä¸è¬èªå¸¦ä¿æ¸©æ¯ï¼ä¸åä¸æ¥ï¼ç§ä¹¦å°±ææ¯åæ¿æ¥ã***åå¿è¿ä¸åï¼ååºå±ç¾¤ä¼çè·ç¦»ä¸ä¸åè¿äºã"éå®æ°æå¹ã</p>
ãã<p>***强è°ï¼"ä¸åºå±è¦å°æ'é¦ä¸æ·»è±'ï¼å¤æ'éªä¸éç'ï¼ä¸è¦'ä¸çªè'ä¼¼å°æ¶å°å·¥ä½åºç¡å¥½ç'çé¨'å°æ¹å»åçé¹ï¼èè¦å¤è·'å·é¨'ï¼å°é®é¢å¤ãå°é¾å¤§ãæ¡ä»¶è¦çå°æ¹å群ä¼ä¸å»é温æãåå®äºã"</p>
</div>
<div id="dd"></div>
</body>
</html>