Groups | Blog | Home
all groups > dotnet jscript > april 2008 >

dotnet jscript : image map and submit form


RICK
4/1/2008 8:08:03 AM
The following will submit a form with a value of "California" for
lstSelectState. How can I add another coordinate for say "Iowa" and change
lstSelectState's value to "Iowa"

<form name="form1" method="post" action="CPC_NCList_Alpha.asp">
<input type="hidden" name="hdnRequestType" value="State">
<map name="Mappings">
<area shape="poly"
coords="9,64,37,74,30,98,58,143,62,153,55,165,38,166,29,151,12,141,10,124,9,112,4,94,3,80,8,65" href="javascript:document.form1.submit()" target="_top">
</map>
<input type="hidden" name="lstSelectState" value="California">
Anthony Jones
4/1/2008 10:58:27 PM

[quoted text, click to view]
coords="9,64,37,74,30,98,58,143,62,153,55,165,38,166,29,151,12,141,10,124,9,
112,4,94,3,80,8,65" href="javascript:document.form1.submit()" target="_top">
[quoted text, click to view]


I've never used an image mapp before but my guess at what you need is:-

<script type="text/javascript">
function mappings_onclick(ev)
{
var area = ev ? ev.target : event.srcElement
document.form1.lstSelectState.value = area.getAttribute("state");
document.form1.submit();
}
</script>

<form name="form1" method="post" action="CPC_NCList_Alpha.asp">
<input type="hidden" name="hdnRequestType" value="State">
<map name="Mappings"
onclick="mappings_onclick.apply(this, arguments)">
<area shape="poly"
coords="9,64,37,74,30,98,58,143,62,153,55,165,38,166,29,151,12,141,10,124,9,
112,4,94,3,80,8,65"
href="javascript:void(0)" state="California">
<area shape="poly"
coords="Iowa coords here"
href="javascript:void(0)" state="Iowa">
</map>
<input type="hidden" name="lstSelectState">
</form>


--

Anthony Jones - MVP ASP/ASP.NET

AddThis Social Bookmark Button