Solved

<MAP> tag and Javascript

Posted on 2007-04-04
4
239 Views
Last Modified: 2010-04-16
Hi All

First off thank you for stopping by.

I am doing this charity run website and have a little trouble making <map> tags and fixed target sized window javascript work together. I can get the pop up window. But there is a problem how the main page jumps to a blank page displaying and [object] tag and nothign else.

Here is the secont of the code im trying to work on:

<map name="mr_r8_c15Map">
  <area shape="rect" coords="245,20,349,41" href="javascript:window.open('http://www.milkrun.sg','test','height=150,width=150')">
</map>

here is the link if you would like to see:
www.milkrun.sg/demo

Just click on the Donation Tab on the right.

Any help on this issue would be much appreciated. Thank you very much!

Evan

0
Comment
Question by:siamesefish
  • 2
4 Comments
 
LVL 63

Accepted Solution

by:
Zvonko earned 500 total points
ID: 18849078
All you need to do is to "return false;"  to kill the anchor move.

Like this:
<map name="mr_r8_c15Map">
  <area shape="rect" coords="245,20,349,41" href="::test" onClick="nw=window.open('http://www.milkrun.sg','test','height=150,width=150');nw.focus();return false;">
</map>


0
 

Author Comment

by:siamesefish
ID: 18849086
That was brilliant! Done perfectly. Thanks a ton! Really appreciate it.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 18849089
For the browsers that do not support the onClick (I am no longer sure if there are any left) you may get away with
href="javascript:w=window.open('http://www.milkrun.sg','test','height=150,width=150'); void()"

or

href="javascript:void(window.open('http://www.milkrun.sg','test','height=150,width=150'))"
0
 

Author Comment

by:siamesefish
ID: 18849090
thanks mplungjan! My problem got solved! Appreciate it!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question