Content available at TutorialsPoint.COM

Javascript - Page Printing


previous next AddThis Social Bookmark Button


Many times you would like to give a button at your webpage to print out the content of that web page via an actual printer.

JavaScript helps you to implement this functionality using print function of window object.

The JavaScript print function window.print() will print the current web page when executed. You can call this function directly using onclick event as follows:

<head>
<script type="text/javascript">
<!--
//-->
</script>
</head>
<body>
<form>
<input type="button" value="Print" onClick="window.print()" />
</form>
</body>

This will produce following button which let you print this page. Try it by clicking:

This serves your purpose to get page printed out, but this is not a recommended way of giving printing facility. You can do one of the followings to make a page printer friendly:

How to print a page:

If someone is providing none of the above facilities then you can use browser's standard toolbar to get web pages printed out. Follow the link as follows:

File --> Print --> Click OK button.



previous next Printer Friendly

Content available at TutorialsPoint.COM

Online Image Processing

Indian Baby Names



Online Image Processing

Indian Baby Names



Advertisements


  

Advertisements