Click to See Complete Forum and Search --> : Modifying a popup window script


robsta117
01-08-2003, 07:19 PM
Modifying a popup window script

Hi -

Right now I'm using a popup window script that doesn't work well on pges with multiple popups - the first window opens okay, but it needs to be closed before a new popup window can be opened. If you don't close the first popup, it moves behind the main page and won't come forward when another popup link is clicked.

Is there any way to modify this script?

<a href="#" onClick="MyWindow1=window.open
('../folder/filename.html','MyWindow1','toolbar=no,
location=no,directories=no,status=no,menubar=no,
scrollbars=no,resizable=yes,width=400,height=540,
left=5px,top=5px');returnfalse;">LINK_TEXT/IMG_HERE</a>

Any and all suggestions appreciated.

Thanks -
Robert:)

pyro
01-08-2003, 07:27 PM
<a href="#" onClick="window.open
('../folder/filename.html','MyWindow1','toolbar=no,
location=no,directories=no,status=no,menubar=no,
scrollbars=no,resizable=yes,width=400,height=540,
left=5px,top=5px');returnfalse;">LINK_TEXT/IMG_HERE</a>

Changing that will allow more than one popup. I also modified the code just a touch...

robsta117
01-08-2003, 07:38 PM
Hi -

That was fast! Thanks for modifying the script - I'll give it a try and let you know how it works.

Much thanks -
Robert :) :) :)

robsta117
01-08-2003, 09:56 PM
Hello again -

Your script modification worked nicely - thanks.

I'm a Mac user, running IE5 and NS7. The script worked perfectly in IE, but there's a minor glitch in NS - it might be a NS issue, or a NS/Mac issue.

Here goes... when the popup window opens, the main page does a "back to top of page" - it doesn't hold its position in the frame.

I've not had a chance to view the page on a PC yet.

Is there anything I can add to script to keep the main page from losing its position?

Here's an example of how I incorporated your script:

<a href="#" class="paper" onClick="window.open('../popups/teton.html','MyWindow3','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,re sizable=yes,width=400,height=540,left=5px,top=5px');returnfalse;">

Thanks again for any help you can give me -
Robert

pyro
01-08-2003, 10:05 PM
The # in the a href is what is causing your problem. What it does is tells the page to go to the top. It shouldn't do it, because it should be doing the onClick event instead of the link. Hmmmm... You could do some thing like this <div onClick=...> but I'm not sure what that will all work in. I don't think it will work at all in NS. :(

robsta117
01-08-2003, 10:39 PM
Hi -

I tried <div onClick> - the popup opened behind the main page.

I tried omitting the "#" - <a href="" but that worked just like <a href="#"

I moved the "class" attribute to the other side of the tag in case it was interfering with the onClick event - no change.

Other than the page not holding its place in NS, I'm still better off than I was earlier today - everything works fine in IE.

Thanks again :)

pyro
01-08-2003, 10:52 PM
Originally posted by robsta117
I tried <div onClick> - the popup opened behind the main page.You could fix that, but since it isn't going to work in everything, I'd use the a href anyway...