程式CODE

2014年10月4日 星期六

javascript列印語法

http://phoenix66600.pixnet.net/blog/post/62561651-%E7%B6%B2%E9%A0%81%E5%88%97%E5%8D%B0%E8%AA%9E%E6%B3%95

http://www.9w2u.com/javascript_show.asp?SHOWID=231



=======按鈕列印========

<SCRIPT LANGUAGE="JavaScript">

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function varitext(text){
text=document
print(text)
}
//  End -->
</script>


<INPUT NAME="print" TYPE="button" VALUE="列印此頁"
ONCLICK="varitext()">

======================



=======載入頁面列印========
<body onload='window.print()'>

=========================

=======部份列印===========
<SCRIPT LANGUAGE="JavaScript">
function printScreen(block){
var value = block.innerHTML;
var printPage = window.open(”",”printPage”,”");
printPage.document.open();
printPage.document.write(”<HTML><head></head><BODY onload=’window.print();window.close()’>”);
printPage.document.write(”<PRE>”);
printPage.document.write(value);
printPage.document.write(”</PRE>”);
printPage.document.write(”</BODY></HTML>”);
}
</script>

<div id="block">
<P><img id=”ruten” name=”ruten” SRC=”http://www.ruten.com.tw/imgs/2008/logo.gif”></P>
</div>
<input type=”button” value=”部分列印” onclick=”printScreen(block)”>


========================

沒有留言:

張貼留言