[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 220
  • Last Modified:

Creating a popup window in a frame

I start with a client-side image map located in a frame.  When I click on a hot spot, I wish to open a popup window in the same frame, without closing the frame.  I have used:

<AREA SHAPE="circle" coords="717, 53, 10" ALT="Name" href="link1.html" onClick="winOpen(this)">

to call the following function:

function winOpen(theLink) {
        linkWindow=window.open(theLink.href,'resizable=yes,width=190,height=135,status=no,location=no,toolbar=no,directories=no,menubar=no,scrollbars=yes');
}

Doesn't work.  What do I do?
0
adamssr
Asked:
adamssr
  • 5
  • 3
  • 3
1 Solution
 
Michel PlungjanIT ExpertCommented:
<AREA SHAPE="circle" coords="717, 53, 10" ALT="Name" href="javascript:winOpen('link1.html')">

function winOpen(theUrl) {
                    linkWindow=window.open(theUrl,'resizable=yes,width=190,height=135,status=no,location=no,toolbar=no,directories=no,menubar=no,scrollbars=yes');

}

Netscape in particular does not like the onClick in area tags

Michel
0
 
adamssrAuthor Commented:
Looks good, but when I tried it, I got an error message (invalid argument).
0
 
Michel PlungjanIT ExpertCommented:
That is because your window.open is invalid - needs a window name, sorry I didn't spot that.

window.open(theUrl,'windowname','width=190,height=135,resizable,scrollbars')

Michel
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
mblaseCommented:
Give him his points back. He forgot to wedge a name for the window between the URL and the attributes:

linkWindow=window.open(theUrl,someName,'resizable=....');
0
 
Michel PlungjanIT ExpertCommented:
Thanks mblase

Spotted it too  ;-)
0
 
adamssrAuthor Commented:
Thanks, Michel.  Works fine.  Now, if I click on another hot spot on the image map, how can I make the new popup window replace the first?  I'll repost this second question with another 50 points for you if you can answer it.
0
 
mblaseCommented:
That's easy -- call winOpen() with a new URL. As long as it uses the same window name and parameters, it'll keep using the same popup window.

You may, however, want to add 'windowname.focus()' to your winOpen() function, to bring that window back to the front.
0
 
Michel PlungjanIT ExpertCommented:
or better, use
<BODY onLoad="if(window.focus) self.focus()">

in the new windows.

Michel

PS: Thanks for your enthusiasm, mblase...
0
 
mblaseCommented:
Hey, I like a race as much as anyone. :) (I'm not trying to steal anyone's points -- by all means, adamssr, give 'em to Michel.)

Now, Michel, you've been on here long enough this morning -- shouldn't you get back to work and let the rest of us earn some points? ;-)
0
 
adamssrAuthor Commented:
Thanks again, Michel.  Works great.  Will post the new question as "For Michel".  Reply something and I'll give you the points.

Thanks also, mblase, but I like Michel's answer.
0
 
Michel PlungjanIT ExpertCommented:
Hehe - save your points Adam...

I will go home, give mblase a few hours to stalk the questions ;-)

Michel
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 5
  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now