Welcome to WebmasterWorld Guest from 54.159.165.175

Forum Moderators: open

pop up window from image map

pop up window, image map

   
8:18 pm on May 6, 2003 (gmt 0)

10+ Year Member



My question doesn't seem to be so basic anymore as I've not been able to find an answer for it in the two years that I've been searching. I have a map of the US listing our rep network. My original concept had planned for a new popup window of a certain size, say 400 X 400 to open up from a hotspot showing the rep contact information. My problem is that I can not find a script that would open a pop up type window from within the imagemap. Currently a user can open up a new window from within the imagemap but, as you may already know, it isn't what I ultimately wanted.
Any ideas you guys may be my last hope?
9:28 pm on May 6, 2003 (gmt 0)

WebmasterWorld Senior Member korkus2000 is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Welcome to WebmasterWorld,

I am confused. What are you trying to do?

You have an image map with a call to a javascript function:
<map name="testing">
<area alt="" coords="56,87,171,230" href="javascript:winOpen()">
</map>

Then in your javascript:
<script>
function winOpen(){
window.open("Sample.htm",null,"height=400,width=400,status=yes,toolbar=no,menubar=no,location=no");
}
</script>

Is this what you are asking?

10:00 pm on May 6, 2003 (gmt 0)

10+ Year Member



No, I currently just have:
<img name="testmap" src="images/testmap.gif" width="0" height="0" border="0" usemap="#testimagemap" alt="Click on area of map to locate the nearest representative.">
<map name="testimagemap">
<area shape="poly" coords="471,272,470,285,479,280" href="whatever.htm" target="_blank" title="" alt="represents us in Florida"></map>

This satisfies the basic operation of opening a window.

But as you already know, it won't open a pop up window to a specified size or with the features that I want; history, no resize, scrollbar, etc. I initially tried inserting the javascript into the tags but quickly found out that it didn't work. Everytime I ask about making this function I usually get an initial response like yours. Then once it's understood what it is I want to do I'll find out that it either can't be done, hasn't been done or the person simply doesn't know how it's done.

11:12 pm on May 6, 2003 (gmt 0)

10+ Year Member



Korkus2000 steered you in the right direction. Just a matter of filling in the blanks.

*Note the bold type:

Put this in the <head>

<script language="JavaScript" type="text/javascript">
function winOpen(goto){
window.open(goto,null,"height=400,width=400,status=yes,toolbar=no,menubar=no,location=no");
}
</script>

...and this in the <body>

<img name="testmap" src="images/testmap.gif" width="0" height="0" border="0" usemap="#testimagemap" alt="Click on area of map to locate the nearest representative.">

<map name="testimagemap">
<area shape="poly" coords="471,272,470,285,479,280" href="javascript:winOpen('whatever.htm')" title="" alt="represents us in Florida">
</map>

*Remove < target="_blank" > from the image map

T

11:28 pm on May 6, 2003 (gmt 0)

10+ Year Member



On the surface it appeared that I was getting the answer, but I wanted to make sure. I'm relieved that someone and someplace was finally able to provide the information that I needed. Thanks
11:52 pm on May 6, 2003 (gmt 0)

10+ Year Member



Jesse,

It might be a good idea to put an actual "name" in the window.open() attributes, instead of null. Something like "location" perhaps? Some browsers (Opera) may choke on it otherwise.

T

12:01 am on May 7, 2003 (gmt 0)

WebmasterWorld Senior Member korkus2000 is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Thanks toadhall, I didn't understand the question. And you should use something other than null. Remember to put the name in quotes to get it to work.

With javascript passing aurguments will allow you to make dynamic functions. Often people will forget about doing this and get stumped on making dynamic functions.

>>Then once it's understood what it is I want to do I'll find out that it either can't be done, hasn't been done or the person simply doesn't know how it's done.

Stay away from those people in the future. ;) Just kidding.

12:28 am on May 7, 2003 (gmt 0)

10+ Year Member



One more caveat Jesse.

goto is a reserved Java keyword in Javascript, and although IE doesn't mind you breaking the rules other more compliant folks (Opera) do.

So change goto to gotop (or gonuts).

Also, as an option, you can use an onClick event handler instead of the href. You won't get the link 'hand' as an indicator; you also won't get the polygon 'lighting up' in IE (although I think there's a trick Mivox mentioned to get rid of it), and there's no audible click.

Anyway just another option to make things more complex than they need to be. ;o)

onClick="javascript:winOpen('whatever.html')"

T

12:31 am on May 7, 2003 (gmt 0)

10+ Year Member



> Thanks toadhall

Happy to contribute Korkus2000.

7:49 pm on May 7, 2003 (gmt 0)

10+ Year Member



I'll certainly come here first from now on.
Thanks again for all the help, now I can get this thing looking like it was meant to look and run.
 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month