3

I have a jsp like this

<%@ include file="commonheader.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<script type="text/javascript">
function passValue(stateid,cityid)
{
if(cityid=="0")
{
    document.forms["test"].action="locator/city.jsp"
    document.forms["test"]["stateid"].value=stateid;
    document.forms["test"].submit();
}
else
{   
    document.forms["test"].action="locator/area.jsp"
    document.forms["test"]["stateid"].value=stateid;
    document.forms["test"]["cityid"].value=cityid;
    document.forms["test"].submit();
}
}
</script>
</head>

<body leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0">
<div align="center">     
<table width="70%" border="0">
<tr>
<td width="80%" align="center"><img src="images/map.jpg" width="550" height="500" border="0" usemap="#Map">
<form id="test" name="test" method="post">
<input type="hidden" name="stateid" />
<input type="hidden" name="cityid"/>       
<map name="Map">
<area shape="rect" coords="81,291,180,305" alt="Maharashtra" onclick="passValue('15','0') />
</map>
</form>
</td>
</tr>
</table>
</div>
</body>
</html>

Form is getting submitted and the values are getting passed correctly. But the problem here is the cursor is not a pointer but a default. I have even tried specifying the style attribute in tag like style="cursor:pointer;" but that didn't work.

Mohammad Saberi
  • 12,864
  • 27
  • 75
  • 127
Hawks
  • 59
  • 2
  • 8

2 Answers2

3

Adding href="javascript:void(null);" to the area tag will do the trick.

abhilashv
  • 1,418
  • 1
  • 13
  • 18
0

I don't believe you are doing anything wrong. If you are looking for a quick solution, just wrap the MAP and IMG in a DIV tag and style that:

http://jsfiddle.net/8PrD9/

This topic may be helpful if you need a more elaborate solution:

Visible Area tag?

HTML5 spec on MAP for reference:

http://www.w3.org/TR/html5/the-map-element.html

I can't find anything which explicitly states that these elements cannot be styled, but that seems to be the general consensus from the research I have done.

Community
  • 1
  • 1
Tim M.
  • 53,671
  • 14
  • 120
  • 163