First we can put the content to be printed in a div, and then use the following code to print. Copy code The code is as follows: <br>function printdiv(printpage)<br>{<br>var headstr = "<html><head><title></title>< /head><body>";<br>var footstr = "</body>";<br>var newstr = document.all.item(printpage).innerHTML;<br>var oldstr = document.body. innerHTML;<br>document.body.innerHTML = headstr newstr footstr;<br>window.print(); <br>document.body.innerHTML = oldstr;<br>return false;<br>}<br>< /script><br><title>div print</title><br></head> <p><body><br>//HTML Page<br>//Other content you wouldn't like to print<br><input name="b_print" type="button" class="ipt" onClick ="printdiv('div_print');" value=" Print "></p> <p><div id="div_print"></p> <p><h1 style="Color:Red">The Div content which you want to print</h1></p> <p></div><br>//Other content you wouldn't like to print<br>//Other content you wouldn't like to print<br></body></p> <p></html><br></p> </div>