JavaScrpit Page Printing

Many time you would like to give  a button at your webpage to  print out the content of that webpage via and 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 webpage when execute .You can call this function directly using onclick event as follows:


<script type=”text/javascript”>

<!- -

//--  >





<input type=”button value=”print “ onclick =”window.print():/>



How to print a page:

If someone is providing none of the above facilities then you can use browsers standard tool bar to get tht webpages printed out.Follow the link as follows:

File   2 print   2 Click OK button.

JavaScript-Page Redirection

When you click a URL to reach to apage X but internally you are directed to another page Y that simply happens because of page re-direction.


<script type=”text/javascrpit”>

function fun1(){

window location =;