Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-21-2003, 07:40 PM   PM User | #1
MattG1225
New Coder

 
Join Date: Nov 2002
Location: CT
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
MattG1225 is an unknown quantity at this point
Unhappy Popup Window

How can I link an HTML webpage and have it open in a simple popup window?!?!?!

MAtt -
MattG1225 is offline   Reply With Quote
Old 01-21-2003, 07:51 PM   PM User | #2
arnyinc
Regular Coder

 
Join Date: Jan 2003
Posts: 867
Thanks: 4
Thanked 8 Times in 8 Posts
arnyinc is an unknown quantity at this point
<a href="javascript:onclick(window.open('yourpage.htm'))">link text</a>

edit: take out the space in java script

Go here for more options:

http://developer.irt.org/script/90.htm

Last edited by arnyinc; 01-21-2003 at 07:57 PM..
arnyinc is offline   Reply With Quote
Old 01-21-2003, 07:57 PM   PM User | #3
beetle
Senior Coder

 
Join Date: Aug 2002
Posts: 3,467
Thanks: 0
Thanked 0 Times in 0 Posts
beetle has a little shameless behaviour in the past
My preferred method
Code:
<a href="somepage.htm" target="sometarget" onclick="window.open(this.href, this.target, features); return false;">link</a>
__________________
My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
“Minds are like parachutes. They don't work unless they are open”
“Maturity is simply knowing when to not be immature”

Last edited by beetle; 01-21-2003 at 10:11 PM..
beetle is offline   Reply With Quote
Old 01-21-2003, 07:58 PM   PM User | #4
arnyinc
Regular Coder

 
Join Date: Jan 2003
Posts: 867
Thanks: 4
Thanked 8 Times in 8 Posts
arnyinc is an unknown quantity at this point
Go with beetle's suggestion. It looks like it is more backwards compliant.
arnyinc is offline   Reply With Quote
Old 01-21-2003, 08:08 PM   PM User | #5
beetle
Senior Coder

 
Join Date: Aug 2002
Posts: 3,467
Thanks: 0
Thanked 0 Times in 0 Posts
beetle has a little shameless behaviour in the past
Quote:
Originally posted by arnyinc
Go with beetle's suggestion. It looks like it is more backwards compliant.
And search engine friendly, too
__________________
My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
“Minds are like parachutes. They don't work unless they are open”
“Maturity is simply knowing when to not be immature”
beetle is offline   Reply With Quote
Old 01-21-2003, 09:26 PM   PM User | #6
MattG1225
New Coder

 
Join Date: Nov 2002
Location: CT
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
MattG1225 is an unknown quantity at this point
Popup Window

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 -
MattG1225 is offline   Reply With Quote
Old 01-21-2003, 09:38 PM   PM User | #7
MattG1225
New Coder

 
Join Date: Nov 2002
Location: CT
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
MattG1225 is an unknown quantity at this point
Popup Window

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 -
MattG1225 is offline   Reply With Quote
Old 01-21-2003, 09:38 PM   PM User | #8
beetle
Senior Coder

 
Join Date: Aug 2002
Posts: 3,467
Thanks: 0
Thanked 0 Times in 0 Posts
beetle has a little shameless behaviour in the past
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: boolean
The 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 buttons
Now, 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.
__________________
My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
“Minds are like parachutes. They don't work unless they are open”
“Maturity is simply knowing when to not be immature”
beetle is offline   Reply With Quote
Old 01-21-2003, 10:02 PM   PM User | #9
MattG1225
New Coder

 
Join Date: Nov 2002
Location: CT
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
MattG1225 is an unknown quantity at this point
Popup Window

Beetle:

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 -
MattG1225 is offline   Reply With Quote
Old 01-21-2003, 10:10 PM   PM User | #10
beetle
Senior Coder

 
Join Date: Aug 2002
Posts: 3,467
Thanks: 0
Thanked 0 Times in 0 Posts
beetle has a little shameless behaviour in the past
<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>
__________________
My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
“Minds are like parachutes. They don't work unless they are open”
“Maturity is simply knowing when to not be immature”
beetle is offline   Reply With Quote
Old 01-21-2003, 10:19 PM   PM User | #11
PauletteB
Regular Coder

 
Join Date: Jun 2002
Posts: 166
Thanks: 0
Thanked 0 Times in 0 Posts
PauletteB is an unknown quantity at this point
If concerned with older Netscape browsers, don't use spaces between the window parameters.
PauletteB is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:09 AM.


Advertisement
Log in to turn off these ads.