<!--printing implementation 1:start-->
<input id= "Btnprint" type= "button" value= "print" onclick= "javascript:window.print ();"/>
<!--will not need to print the section labeled class= "Noprint"-
<style type= "Text/css" media=print>
. Noprint{display:none}
</style>
<p class= "Noprint" > where printing is not required </p>
<p> Printed Parts </p>
<!--printing implementation 1:end-->
<!--************************* 2011-09-28 updated code ****************************-
<!--printing implementation 2:start-->
<input id= "Btnprint" type= "button" value= "Print Preview" Onclick=preview (1)/>
<script>
Function Preview (OPER)
{
if (Oper < 10)
{
bdhtml=window.document.body.innerhtml;//get the HTML code for the current page
Sprnstr= "<!--startprint" +oper+ "--";//Set Print start area
Eprnstr= "<!--endprint" +oper+ "--";//Set Print End area
Prnhtml=bdhtml.substring (Bdhtml.indexof (SPRNSTR) +18); To take HTML back from the start code
Prnhtml=prnhtml.substring (0,prnhtml.indexof (EPRNSTR));//Fetch HTML from the end code
window.document.body.innerhtml=prnhtml;
Window.print ();
window.document.body.innerhtml=bdhtml;
} else {
Window.print ();
}
}
</script>
<p>XXXXX</p>
<!--startprint1--> What to print <!--endprint1-->
Add a Print button Onclick=preview (1)
<!--printing implementation 2:end-->
<HTML>
<HEAD>
<title>javascript Print-print page setup-Print Preview Code </TITLE>
<meta http-equiv=content-type content= "text/html; charset=gb2312 "/>
<script language=javascript>
function Printsetup () {
Print Page Setup
WB.EXECWB (8,1);
}
function PrintPreview () {
Print Page Preview
WB.EXECWB (7,1);
}
function PrintIt ()
{
if (Confirm (' OK to print? ‘)) {
WB.EXECWB (6,6);
}
}
</SCRIPT>
</HEAD>
<BODY>
<div align=center>
<object ID=WB height=0 width=0
CLASSID=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 name=wb></object>
<input onclick=javascript:printit () Type=button value= print Name=button_print/>
<input Onclick=javascript:printsetup (); Type=button value= print Page Setup name=button_setup/>
<input Onclick=javascript:printpreview (); Type=button value= Print Preview Name=button_show/>
One press the start weight loss card time period
</DIV>
</BODY>
</HTML>
<script type= "Text/javascript" src= "Jquery-1.4.2.min.js" ></script>
<script type= "Text/javascript" src= "jquery. Printarea.js "></script>
<script>
$ (document). Ready (function () {
$ ("Input#biuuu_button"). Click (function () {
$ ("Div#myprintarea"). PrintArea ();
});
});
</script>
<input id= "Biuuu_button" type= "button" value= "Print" ></input>
<div id= "Myprintarea"; Text Print Section .....</div>
JS to achieve the printing function