...

View Full Version : open child window



DsgnrsTLZAdmin
03-19-2004, 09:29 PM
what might be wrong with this?





<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>

Choopernickel
03-19-2004, 09:36 PM
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?

DsgnrsTLZAdmin
03-19-2004, 10:49 PM
that doesnt make a difference. I dont even see a difference in my code and whatever you said was wrong.

peasantry
03-20-2004, 02:01 PM
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>

Paul Jr
03-20-2004, 04:15 PM
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.

Willy Duitt
03-20-2004, 04:32 PM
In addition to the problem Choopernickel pointed out.
Your script is broke across several lines.
( Lines 4, 5 and 6 should be one line)


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

sage45
03-20-2004, 05:52 PM
In other words, this:
<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:
<script language="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>With no line breaks.
HTH,

-sage-

Willy Duitt
03-20-2004, 05:56 PM
The forum broke the script again. :(

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. :mad:

DsgnrsTLZAdmin
03-20-2004, 11:26 PM
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:



<a href="#"onclick="popUp('/pages/changetheme.php')";>Change theme</a>

Basscyst
03-20-2004, 11:48 PM
Perhaps this will help,

The correct paramaters for window.open:




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

Willy Duitt
03-21-2004, 12:32 AM
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:

<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

DsgnrsTLZAdmin
03-21-2004, 02:21 AM
I think I should know that it needs to be on one line :rolleyes: C'mon, Ive been a programmer of 5 languages for years. I got this thing worked out now. Thanks Ya'll :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum