Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q1715 How can I concatenate two values from two select lists to the URL associated with a clicked image map?

You are here: irt.org | FAQ | JavaScript | Image | Q1715 [ previous next ]

Try:

<html>

<head>

<script language="JavaScript"><!--
var value1 = value2 = '';
function go(where) {
  var value1 = document.myForm.select1.options[document.myForm.select1.selectedIndex].value;
  var value2 = document.myForm.select2.options[document.myForm.select2.selectedIndex].value;
  location.href = where + '?name1=' + escape(value1) + '&name2=' + escape(value2);
  return false;
}
//--></script>

</head>

<body>

<map name="image-map1">
<area shape="rect" coords="15,15,85,85" href="default.htm"  onClick="return go('square.htm')">
<area shape="rect" coords="93,15,110,85" href="default.htm" onClick="return go('rect.htm')">
<area shape="circle" coords="150,50,35" href="default.htm"  onClick="return go('circle.htm')">
</map>

<form name="myForm">
<select name="select1">
<option value="1">one
<option value="2">two
<option value="3">three
</select>

<select name="select2">
<option value="1">one
<option value="2">two
<option value="3">three
</select>
</form>

<img src="image.gif" border=0 width=200 height=100 usemap="#image-map1">

</body>

</html>

©2018 Martin Webb