<html>
<head><title>Image Map</title>
</head>
<body>
Welcome to USA Map<br><br>
Click on Map to find out <br><br>
<script type="text/javascript">
$(function() { //run when the DOM is ready
$("#planetmap area").click(function (e) {
// jQuery code, event handling callbacks here
alert();
});
});
</script>
<select id="listbox" size="5" multiple>
<option value="none">Take a pick on the map</option>
<option value="wyoming">Wyoming</option>
<option value="arizona">Arizona</option>
</select>
<img src="usaStateMap.jpg" alt="usa" usemap="#planetmap"/>
<map name="planetmap" id="planetmap">
<area id="wyoming" alt="Wyoming" title="Wyoming" href="#" shape="poly"
coords="203,125,192,188,278,198,284,136" />
<area id="arizona" alt="Arizona" title="arizona" href="#" shape="poly"
coords="138,258,118,330,188,361,201,269" />
</map>
</body>
</html>
The map will be launched in a child window and Listbox in parent window. On click event of Javascript I want to be able to multi select same items(States) in a Listbox. Can you please help.
<script src="jquery.js"></script>
<script type="text/javascript">
$(function() { //run when the DOM is ready
$("#planetmap area").click(function (e) {
// jQuery code, event handling callbacks here
$('#mymapselect option[value="' + this.id + '"]').attr('selected', 'selected');
});
});
</script>
I downloaded the jquery.js file from http://learn.jquery.com/about-jquery/how-jquery-works/#jQuery:_The_Basics and added as reference. Now the click event works for Imagemap area . It multiselects items in listbox.