PDA

View Full Version : Opening a New Window; IE and Mozilla


carld
01-30-2003, 03:13 PM
Here is my script in the header:

<script type="text/javascript" language="javascript">
function openpopup(popurl,popwin){
winpops=window.open(popurl,popwin,"width=450,height=600,scrollbars,resizable,menubar,location,toolbar,status")
}
</script>

The script is called in a link like so:
<a href="javascript:openpopup('my_dog.htm','My Dog')">My Dog</a>

I've looked through the archives here and this script is actually an example given of how to open a new window, but it doesn't work for me.

Any suggestions on how to make this work well with IE and Mozilla? Thanks in advance.

beetle
01-30-2003, 03:32 PM
Look ok to me.

What happens when it doesn't work? Does the page not load? Is there a javascript error?

justame
01-30-2003, 04:07 PM
car...
try just a removing® this part...
winpops=

when /me just a uses® that script??? the line starts just a with®...
window.open ...etc...

arnyinc
01-30-2003, 04:12 PM
The script is interpreting your second parameter as the name/target of the window and it has a space in it which is not allowed. Change 'My Dog' to 'MyDog' and that would fix it.


<html>
<head>
<script type="text/javascript" language="javascript">
function openpopup(popurl,popwin){
winpops=window.open(popurl, popwin,"width=450,height=600,scrollbars,resizable,menubar,location,toolbar,status");
}
</script>
</head>
<body>
<a href="javascript:openpopup('buh.htm','MyDog')">My Dog</a>
</body>
</html>


edit: there's no space in javascript:, but it keeps showing up like that

beetle
01-30-2003, 04:49 PM
Good eye, arnyinc.

That space would certainly cause a problem