View Full Version : How do you open a new window?

09-28-2002, 04:50 PM
When a person enters your webpage, how do you make it so it automaticly opens a new window?


I got to www.dynamicdrive.com

but when I get there a new window opens up advertising cutandpaste.

How do I do this on my webpage?

Mr J
09-28-2002, 05:09 PM
On the fly:

<A HREF="#null" ONCLICK="window.open('Your Page.htm', 'win1','width=300,height=100,left=450,top=250,toolbar=yes');return false">Your Link</A>

Using a script:

function newWin(theURL)
var newWin=open((theURL),'','width=200,height=100,top=300,left=250' )

<a href="javascript:newWin('yourpage.htm')">Link</a>

You can use setTimeout method to open after set time or use onload

09-28-2002, 05:40 PM
<body onload="window.open('popuppage.html')">

09-29-2002, 01:41 AM
Is it possible to set a size for the window that opens?

09-29-2002, 02:39 AM
<body onload="window.open('Your Page.htm', 'win1','width=300,height=100,left=450,top=250,tool

Mr J
09-29-2002, 08:31 PM
Just change the width and height attributes to the size you want.

Same with the position: left and top

09-29-2002, 10:55 PM
or if you want a new window with no bells or whistles...

<a href="page.html" target="_blank">click here</a>


09-30-2002, 08:46 AM
<NOTE> Different resolutions will have your window opening in different locations on your page regardless of instructions. It's best to use a centering technique.</NOTE> :thumbsup: