is there any way to print only contents(small part) of a whole page, instead of printing the whole page without opening the new popup or page or new window.
i tried the following but still its opening the new window asking the print
- Code: Select all
<html>
<head><title>print</title>
<script language="javascript">
function printspecial(){
document.getElementById("mainContent").focus();
window.print();
}
function print_special()
{
var disp_setting="toolbar=no,location=no,directories=no,menubar=no,";
disp_setting+="scrollbars=yes, left=100, top=25";
var content_vlue = document.getElementById("mainContent").innerHTML;
var docprint=window.open("","",disp_setting);
docprint.document.open();
docprint.document.write('<html><head><title>Print</title>');
docprint.document.write('</head><body onLoad="self.print()"><center>');
docprint.document.write(content_vlue);
docprint.document.write('</center></body></html>');
docprint.document.close();
docprint.focus();
}
</script>
</head>
<body>
<div align="left" id="mainContent">
this is the printing content, this is the printing content,this is the printing content
this is the printing content
this is the printing content
this is the printing content
this is the printing content
this is the printing content
</div>
this is not printing content
<img src="/images/printer.jpg" width="35" height="35" border="0" onClick="printspecial()">
</body>
</html>
but in above case i dont want to open the popup window,
any easy way to print without opening the new window.
Regards
Sanjeevkumar

