homepage Welcome to WebmasterWorld Guest from 54.167.177.180
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
pop up window from image map
pop up window, image map
JesseT

10+ Year Member



 
Msg#: 760 posted 8:18 pm on May 6, 2003 (gmt 0)

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?

 

korkus2000

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



 
Msg#: 760 posted 9:28 pm on May 6, 2003 (gmt 0)

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?

JesseT

10+ Year Member



 
Msg#: 760 posted 10:00 pm on May 6, 2003 (gmt 0)

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.

toadhall

10+ Year Member



 
Msg#: 760 posted 11:12 pm on May 6, 2003 (gmt 0)

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

JesseT

10+ Year Member



 
Msg#: 760 posted 11:28 pm on May 6, 2003 (gmt 0)

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

toadhall

10+ Year Member



 
Msg#: 760 posted 11:52 pm on May 6, 2003 (gmt 0)

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

korkus2000

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



 
Msg#: 760 posted 12:01 am on May 7, 2003 (gmt 0)

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.

toadhall

10+ Year Member



 
Msg#: 760 posted 12:28 am on May 7, 2003 (gmt 0)

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

toadhall

10+ Year Member



 
Msg#: 760 posted 12:31 am on May 7, 2003 (gmt 0)

> Thanks toadhall

Happy to contribute Korkus2000.

JesseT

10+ Year Member



 
Msg#: 760 posted 7:49 pm on May 7, 2003 (gmt 0)

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved