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 03-19-2004, 09:29 PM   PM User | #1
DsgnrsTLZAdmin
Regular Coder

 
Join Date: Jan 2004
Location: Georgia
Posts: 306
Thanks: 0
Thanked 0 Times in 0 Posts
DsgnrsTLZAdmin is an unknown quantity at this point
open child window

what might be wrong with this?



Code:
<script language="javascript">
function popUp(url)
{
window.open(url,'new_win','height=180,width=200','scrollbars=yes,toolbar=no,resizable=no,menubar=no,directories=no')
}
</script>
__________________
~Designer's Toolz~
DsgnrsTLZAdmin is offline   Reply With Quote
Old 03-19-2004, 09:36 PM   PM User | #2
Choopernickel
Regular Coder

 
Join Date: Apr 2003
Location: Atlanta, GA
Posts: 487
Thanks: 0
Thanked 0 Times in 0 Posts
Choopernickel is an unknown quantity at this point
Re: open child window

window.open(url,'new_win','height=180,width=200 ',' scrollbars=yes,toolbar=no,resizable=no,menubar=no,directories=no');

The bold, red part is wrong with that. Change to a single comma, and you should be good to go.


edit: tags? the hell?

Last edited by Choopernickel; 03-19-2004 at 09:39 PM..
Choopernickel is offline   Reply With Quote
Old 03-19-2004, 10:49 PM   PM User | #3
DsgnrsTLZAdmin
Regular Coder

 
Join Date: Jan 2004
Location: Georgia
Posts: 306
Thanks: 0
Thanked 0 Times in 0 Posts
DsgnrsTLZAdmin is an unknown quantity at this point
that doesnt make a difference. I dont even see a difference in my code and whatever you said was wrong.
__________________
~Designer's Toolz~
DsgnrsTLZAdmin is offline   Reply With Quote
Old 03-20-2004, 02:01 PM   PM User | #4
peasantry
New to the CF scene

 
Join Date: Mar 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
peasantry is an unknown quantity at this point
nothing is wrong.

<script language="javascript">
function popUp(url)
{
window.open(url,'new_win','height=180,width=200','scrollbars=yes,toolbar=no,resizable=no,menubar=no, directories=no')
}
popUp("http://www.google.com")
</script>
peasantry is offline   Reply With Quote
Old 03-20-2004, 04:15 PM   PM User | #5
Paul Jr
Regular Coder

 
Join Date: Dec 2003
Location: USA
Posts: 230
Thanks: 0
Thanked 0 Times in 0 Posts
Paul Jr is an unknown quantity at this point
Actually, there is something wrong, as Choopernickle pointed out.

The open(); method of the Window object takes four optional arguments.
The first argument is the URL of the page to be displayed in the new window.
The second argument is the name of the window.
The third argument is a list of features that specify the window size and GUI decorations.
The fourth is a boolean value that specifies whether the URL specified as the first argument should replace the current entry in the window's browsing history, or create a new entry. This is only useful if the second argument names a window that already exists.

Basically: you have incorrectly split up the third argument (list of features) into two separate arguments. Remove the apostrphes (') as Choopernickle said, and you'll be good to go.

Last edited by Paul Jr; 03-20-2004 at 04:17 PM..
Paul Jr is offline   Reply With Quote
Old 03-20-2004, 04:32 PM   PM User | #6
Willy Duitt
Banned

 
Join Date: Sep 2003
Posts: 3,620
Thanks: 0
Thanked 0 Times in 0 Posts
Willy Duitt is an unknown quantity at this point
In addition to the problem Choopernickel pointed out.
Your script is broke across several lines.
( Lines 4, 5 and 6 should be one line)

Code:
1: <script language="javascript">
2: function popUp(url)
3: {
4: window. open(url,'new_win','height=180,width=200','scrollb
5:  ars=yes,toolbar=no,resizable=no,menubar=no,directo
6: ries=no')
7: }
8: </script>
.....Willy
Willy Duitt is offline   Reply With Quote
Old 03-20-2004, 05:52 PM   PM User | #7
sage45
Super Moderator


 
Join Date: May 2002
Posts: 1,036
Thanks: 0
Thanked 11 Times in 11 Posts
sage45 is an unknown quantity at this point
In other words, this:
Code:
<script language="javascript">
function popUp(url)
{
window. open(url,'new_win','height=180,width=200','scrollb
 ars=yes,toolbar=no,resizable=no,menubar=no,directo
ries=no')
}
</script>
Should be this:
Code:
<script language="javascript">
function popUp(url)
{
window.open(url,'new_win','height=180,width=200,scrollbars=yes,toolbar=no,resizable=no,menubar=no,directories=no')
}
</script>
With no line breaks.
HTH,

-sage-
__________________
HTML & CSS Forum Moderator

"If you don't know what you think you know, then what do you know."
R.I.P. Derrick Thomas #58
1/1/1967 - 2/8/2000
sage45 is offline   Reply With Quote
Old 03-20-2004, 05:56 PM   PM User | #8
Willy Duitt
Banned

 
Join Date: Sep 2003
Posts: 3,620
Thanks: 0
Thanked 0 Times in 0 Posts
Willy Duitt is an unknown quantity at this point
The forum broke the script again.
Code:
1: <script language="javascript">
2: function popUp(url)
3: {
4: window. open(url,'new_win','height=180,width=200,scrollbar
5:  s=yes,toolbar=no,resizable=no,menubar=no,directori
6: es=no')
7: }
8: </script>
Try this:


<script type="text/javascript">
function popUp(url){
window.open(url,'new_win','height=180,width=200,scrollbars=yes,toolbar=no,resizable=no,menubar=no,di rectories=no')
}
</script>


.....Willy

Edit: The forum is still breaking the script.

Last edited by Willy Duitt; 03-20-2004 at 05:59 PM..
Willy Duitt is offline   Reply With Quote
Old 03-20-2004, 11:26 PM   PM User | #9
DsgnrsTLZAdmin
Regular Coder

 
Join Date: Jan 2004
Location: Georgia
Posts: 306
Thanks: 0
Thanked 0 Times in 0 Posts
DsgnrsTLZAdmin is an unknown quantity at this point
Quote:
In other words, this:
code:--------------------------------------------------------------------------------<script language="javascript">
function popUp(url)
{
window. open(url,'new_win','height=180,width=200','scrollb

ars=yes,toolbar=no,resizable=no,menubar=no,directo

ries=no')
}
</script>--------------------------------------------------------------------------------
Should be this:
code:--------------------------------------------------------------------------------<script language="javascript">
function popUp(url)
{
window. open(url,'new_win','height=180,width=200,scrollbar
s=yes,toolbar=no,resizable=no,menubar=no,directori
es=no')
}
</script>--------------------------------------------------------------------------------
With no line breaks.
HTH,

Nope, still doesnt work. The problem with the orginal was it worked in IE but not mozilla. That code doesnt work in either. This is what I'm using to call the script:

Code:
<a href="#"onclick="popUp('/pages/changetheme.php')";>Change theme</a>
__________________
~Designer's Toolz~
DsgnrsTLZAdmin is offline   Reply With Quote
Old 03-20-2004, 11:48 PM   PM User | #10
Basscyst
Smokes a Lot


 
Join Date: Jul 2003
Location: CA, USA
Posts: 1,594
Thanks: 5
Thanked 20 Times in 20 Posts
Basscyst is on a distinguished road
Perhaps this will help,

The correct paramaters for window.open:

Code:
var popper=window.open('URL','WindowName','Property1,Property2');
Add as many window properties as you wish seperated by commas.

The previous code works you just need to take out the line breaks.

Basscyst
__________________
Helping to build a bigger box. - Adam Matthews
Basscyst is offline   Reply With Quote
Old 03-21-2004, 12:32 AM   PM User | #11
Willy Duitt
Banned

 
Join Date: Sep 2003
Posts: 3,620
Thanks: 0
Thanked 0 Times in 0 Posts
Willy Duitt is an unknown quantity at this point
As Basscyst pointed out.
The previously posted script does work but the forum software is breaking the script by adding line breaks because the window.open(...) string is too long.

Try this:
Code:
<script type="text/javascript">
function popUp(url){
features = 'height=180,width=200,';
features+= 'scrollbars=yes,toolbar=no,';
features+= 'resizable=no,menubar=no,';
features+= 'directories=no';
window.open(url,'new_win',features)
}
</script>
<a href="http://google.com" onclick="popUp(href);return false">Google</a>
.....Willy
Willy Duitt is offline   Reply With Quote
Old 03-21-2004, 02:21 AM   PM User | #12
DsgnrsTLZAdmin
Regular Coder

 
Join Date: Jan 2004
Location: Georgia
Posts: 306
Thanks: 0
Thanked 0 Times in 0 Posts
DsgnrsTLZAdmin is an unknown quantity at this point
I think I should know that it needs to be on one line C'mon, Ive been a programmer of 5 languages for years. I got this thing worked out now. Thanks Ya'll
__________________
~Designer's Toolz~
DsgnrsTLZAdmin 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 02:08 PM.


Advertisement
Log in to turn off these ads.