Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

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

irt.org | Knowledge Base | JavaScript | Image | Q1715 [ previous next ]

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

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>

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.