Sponsored Ad

Friday, April 16, 2010

How to Print a Page in JavaScript

 

While website development, there is always need of client side rich functionalities. JavaScript is very powerful client side language, which supports number of good functionalities.  Lets discuss print functionality in JavaScript.

window.print() function is used to print the current page.  you need to call it at any particular event. The sample code is given below. Please let me know if you face any problem while implementing.

<html>
<head>
<script type="text/javascript">
function printpage()
{ window.print() }
</script>
</head>
<body>
<form>
<input type="button" value="Print this page" onclick="printpage()">
</form>
</body>
</html>

No comments:

Post a Comment

Sponsored Ad

Development Updates