The JavaScript print function performs the same operation as the print option that you see at the top of your browser window or in your browser’s “File” menu. The JavaScript print function will send the contents of the webpage to the user’s printer.

JavaScript Print Script – window.print()

The JavaScript print function window.print() will print the current webpage when executed. In this example script, we will be placing the function on a JavaScript button that will perform the print operation when theonClick event occurs.
<html>

<body>
<form>
<input type="button" value="Print This Page" onClick="window.print()" />
</form>

</body>
</html>

Display:

If you click this button you should be prompted with whatever application your computer uses to handle its print functionality.

JavaScript Redirect

You’re moving to a new domain name. You have a time-delay placeholder on your download site. You have a list of external web servers that are helping to mirror your site. What will help you deal with and/or take advantage of these situations? JavaScript redirects will.
When your webpage is moved, you’d probably want to notify your visitors of the change. One good way is to place a “redirect page” at the old location which, after a timed delay, will forward visitors to the new location of your webpage. You can do just this with a JavaScript redirection.

0 comments:

Post a Comment

 
Top
Blogger Template