Thursday, December 9, 2010

Print the content of a DIV using javascript

<head>
<style type="text/css">

@media print
{
#non-printable { display: none; }
#printable { display: block; }
}
</style>
</head>
<body>
<div id="printable">
The content of the page that needs to be printed.
</div>

<div id="non-printable">
<a href="javascript:void(0);" onclick="javascript:window.print();">Print Content</a>
</div>
</body>

No comments:

Post a Comment