View Full Version : Popup Window

01-21-2003, 07:40 PM
How can I link an HTML webpage and have it open in a simple popup window?!?!?!

MAtt -

01-21-2003, 07:51 PM
<a href="javascript:onclick(window.open('yourpage.htm'))">link text</a>

edit: take out the space in java script

Go here for more options:


01-21-2003, 07:57 PM
My preferred method
<a href="somepage.htm" target="sometarget" onclick="window.open(this.href, this.target, features); return false;">link</a>

01-21-2003, 07:58 PM
Go with beetle's suggestion. It looks like it is more backwards compliant. :o

01-21-2003, 08:08 PM
Originally posted by arnyinc
Go with beetle's suggestion. It looks like it is more backwards compliant. :o And search engine friendly, too ;)

01-21-2003, 09:26 PM
Beetle: I not clear on the end part of the popup window code you gave me:

(this.href, this.target, features);">

Is this.href and this.target the same source as "somepage.htm" and "sometarget"? And what is features. Can you throw together a quick example. Thanks in advance!

Matt -

01-21-2003, 09:38 PM
I get what the features are: toolbar, size, etc, but I didn't get that to work. I did get the window to open in a popup though.

Matt -

01-21-2003, 09:38 PM
features is a comma separated string of window features. The most common features are (with their datatype) width: integer
height: integer
top: integer
left: integer
location: boolean
menubar: boolean
scrollbars: boolean
status: boolean
toolbar: booleanThe width, height, top and left all pertain to the popup's size and position. All the rest of these features are literally window features location - the address bar
menubar - File Edit View etc...
scrollbars - duh
status - the statusbar at the bottom of the window
toolbar - The back, foward, home, etc buttonsNow, by default, all the window features are off, or have a false value, so you only need to include those which you want to be true.

window.open( this.href, this.target, 'width=300, height=200, top=100, left=100, status=1, scrollbars=1, toolbar=1');

This opens a 300x200 window, positioned at 100,100 with the statubar, scrollbars, and the toolbar.

01-21-2003, 10:02 PM

How do I list the target? I have it as target="_blank", but what about the this.target. What do I do with that?

Here's my current code:

<a href="case.html" target="_blank" onClick="window.open(case.html),'height=300, width=300, top=100, left=100, status=1, scrollbars=1, toolbars=1';">link</a>

Matt -

01-21-2003, 10:10 PM
<a href="case.html" target="_blank" onClick="window.open(this.href, this.target,'height=300, width=300, top=100, left=100, status=1, scrollbars=1, toolbars=1'); return false;">link</a>

01-21-2003, 10:19 PM
If concerned with older Netscape browsers, don't use spaces between the window parameters.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum