jaql;10931635 wrote:First, I'd read this.
Second, here's a stripped down example of what you're trying to do:
<html>
<head>
<title>test script</title>
<script language="JavaScript" type="text/javascript">
function populateMenuForm() {
alert('made it here');
return false;
}
</script>
</head>
<body>
<img src="green.jpg" width="330" height="300" alt="Green" usemap="#greentest" />
<map name="greentest">
<area shape="rect" coords="0,0,330,300" id="test" alt="test" onclick="populateMenuForm();" href="javascript:void(0);" />
</map>
</body>
</html>
jaql, thanks for your response but please allow me to clear up what I am asking (plus I copied in the wrong code), taking a Source View of the code from the browser the following code is generated:
<td colspan="3"><img usemap="#menumap" src="productImage.jpg" height="1102" width="713" alt="Margherita" border="0" /><br/>
<script language="JavaScript" type="text/javascript">//<![CDATA[
function populateMenuForm(menuitem_id, itemprice) {
alert('made it here');
document.addtocart.prod_id[].value = menuitem_id;
document.addtocart.product_id.value = menuitem_id;
document.addtocart.set_price[].value = itemprice;
document.addtocart.submit();
return false;
}
//]]>
</script>
<map name="menumap">
<area shape="rect" coords="98,69,580,85" id="20" alt="Lamp Shade" title="11.95000" onclick="populateMenuForm(this.id, this.title);" href="javascript:void(0);" />
<area shape="rect" coords="56,93,625,109" id="21" alt="1622 End Table" title="7.95000" onclick="populateMenuForm(this.id, this.title);" href="javascript:void(0);" />
<area shape="rect" coords="61,133,620,163" id="22" alt="Silver Set" title="8.95000" onclick="populateMenuForm(this.id, this.title);" href="javascript:void(0);" />
</map>
So as you can see the code "appears" ok. I am needing to assign the id and title values to fields in the form: addtocart from the function via the onclick. Thus my issue with onclick.