here is only one way to print selected html to print
function getPrint(print_area)
{
//Creating new page
//var pp = window.open('','MenuAlaCarte','fullscreen=1,scrollbars=1');
var pp =
window.open('','MenuAlaCarte','height=1024,width=1024,alwaysLowered=0,alwaysRaised=0,channelmode=0,dependent=0,directories=0,fullscreen=1,hotkeys=1,location=0,menubar=0,resizable=1,scrollbars=1,status=0,titlebar=1,toolbar=0,z-lock=0');
//Adding HTML opening tag with <HEAD> … </HEAD> portion
pp.document.writeln('<HTML><HEAD><link
rel="stylesheet" type="text/css" href="style/style.css"
/><title>Print Preview</title><LINK href=Styles.css
type="text/css" rel="stylesheet">')
pp.document.writeln('<LINK href=PrintStyle.css type="text/css"
rel="stylesheet" media="print"><base
target="_self"></HEAD>')
//Adding Body Tag
pp.document.writeln('<body MS_POSITIONING="GridLayout"
bottomMargin="0" leftMargin="0" topMargin="0" rightMargin="0">');
//Adding form Tag
pp.document.writeln('<form method="post">');
//Creating two buttons Print and Close within a table
pp.document.writeln('<TABLE
width=100%><TR><TD></TD></TR><TR><TD
align=right><INPUT ID="PRINT" type="button" class="button2"
value="Print"
onclick="javascript:location.reload(true);window.print();"><INPUT
ID="CLOSE" type="button" class="button2" value="Close"
onclick="window.close();"></TD></TR><TR><TD></TD></TR></TABLE>');
//Writing print area of the calling page
pp.document.writeln(document.getElementById(print_area).innerHTML);
//Ending Tag of </form>, </body> and </HTML>
pp.document.writeln('</form></body></HTML>');
// pp.document.writeln('<script language="javascript" type="text/javascript">');
// pp.document.writeln('function Print(){');
// pp.document.writeln(' window.print();');
// // pp.document.writeln('window.close();');
// pp.document.writeln(' }Print();</script> ');
return false;
}
on click of print button u call the getPrint(print_area) function with one parameter (Id of DIV)
View Blog For Latest Updates
My Blog http://www.center4code.blogspot.com/
Don't forget to click “Mark as Answer” on the post that helped you