Javascript
JS intro
JS basics
JS variables
JS functions
JS popup boxes
JS conditional logic
JS loops
JS arrays
JS objects
JS strings
JS events
JS errors
JS DOM
JS elements
JS new windows
JS date and time
JS cookies
JS print
JS redirect
JS void 0
JS Summary

Programming

Programming intro
Java

Markup

First webpage guide
HTML
XHTML

Style & Layout

CSS

Browser scripting

VBScript
AJAX

Server scripting

PHP
ASP

Making money online

Make money online

Javascript print

Javascript provides the ability to send the content of a webpage to be printed.

This lesson focuses on:

The print() function

The print() function can be used to send the content of a webpage to be printed. This function will not actually print the page, but will achieve the same effect as going to the "File" menu and choosing the print option -- it will bring up the print options window in which you choose how to print a document.

Example:

<input type="button" onclick="window.print()" value="Print this page" />

Output:

Click on the button to bring up the print options window in which you can choose how to print a document.

Practice

Online code editor
Practical examples
Practical exercises
Step-by-step tutorials

Reference

Terms glossary
Reference material

Rate this site

Rate this site
Visitor comments