Open A Window

Below are 9 different ways to open a single window with javascript. They include a text link, image link, form button, onload, onunload and onmouseover.

In case you're thinking of doing something sneaky with the onmouseover versions, forget it. Almost all browsers ask the user if they want to close the window before it happens.

Try not to get too carried away with the use of onmouseover, onload and onunload if you want people to visit your homepage more than once.

Open a window with a text link.

Highlight The Source Code Below

Do the same thing with onmouseover.

Highlight The Source Code Below

Open a window with an image button.

Highlight The Source Code Below

Do the same thing with onmouseover.

Highlight The Source Code Below

Open a window with a form button.

Highlight The Source Code Below

Do the same thing with onmouseover.

Highlight The Source Code Below

Open a window with onload in the body tag.

Highlight The Source Code Below

Open a window with onunload in the body tag.

Highlight The Source Code Below

Open Lycos.com in another browser window.

Highlight The Source Code Below


Opening Multiple Windows

Below are 16 different ways to open multiple windows at the same time with javascript. They include a text link, image link, form button, onload, onunload and onmouseover.

Don't think that you can only open two windows at a time. You can open as many as you need to by simply adding the code end to end with semicolons between them as terminators. Don't get to carried away with this if you want people to visit your site more than once.

Open Lycos.com and Yahoo.com in two new browser windows without loading anything into this window by clicking on a text link.

Highlight The Source Code Below

Do the same thing with onmouseover.

Highlight The Source Code Below

Open Lycos.com and Yahoo.com in two new browser windows and load MSN.com into this window by clicking on a text link.

Highlight The Source Code Below

Open Lycos.com and Yahoo.com in two new browser windows without loading anything into this window by clicking on an image link.

Highlight The Source Code Below

Do the same thing with onmouseover.

Highlight The Source Code Below

Open Lycos.com and Yahoo.com in two new browser windows and load MSN.com into this window by clicking on an image link.

Highlight The Source Code Below

Open Lycos.com and Yahoo.com in two new browser windows without loading anything into this window by clicking on a form button.

Highlight The Source Code Below

Do the same thing with onmouseover.

Highlight The Source Code Below

Open Lycos.com and Yahoo.com in two new browser windows and load MSN.com into this window by clicking on a form button.

Highlight The Source Code Below

Do the same thing with onmouseover.

Highlight The Source Code Below

Open Lycos.com and Yahoo.com in two new browser windows without loading anything into this window using onload in the body tag.

Highlight The Source Code Below

Open Lycos.com and Yahoo.com in two new browser windows without loading anything into this window using onunload in the body tag.

Highlight The Source Code Below

Open Lycos.com and Yahoo.com in two new browser windows.

Highlight The Source Code Below

In the examples above I could have opened any amount of windows using these same methods. Just add a semicolon between each function to act as a terminator.

Open five windows by clicking on one text link.

Highlight The Source Code Below

Open Lycos.com and Yahoo.com in two new browser windows without loading anything into this window using a form radio button.

Highlight The Source Code Below

Open Lycos in a new browser window without using javascript.

Highlight The Source Code Below



<<< Back



Home Page       This Page Was Last Updated: