It Displays the informatio of the latest marker added.If i want to
display the previous marker information. How should i do it?
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0px; padding: 0px }
#map_canvas { height: 100% }
</style>
<script type="text/javascript"
src="
http://maps.google.com/maps/api/js?sensor=true">
</script>
<script type="text/javascript">
var map,marker;
function initialize() {
var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
var myOptions = {
zoom: 12,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
//alert(myOptions.zoom);
map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
var html="<p>Hello</p>";
infowindow=new google.maps.InfoWindow({content:html});
google.maps.event.addListener(map, "click", function(event) {
marker = new google.maps.Marker({
position: event.latLng,
map: map,
clickable:true
});
google.maps.event.addListener(marker, "click", function() {
infowindow.open(map, marker);
});
});
}
function placeMarker(location) {
marker = new google.maps.Marker({
position: location,
map: map
});
//alert(location.lat());
//map.setCenter(location);
}
</script>
</head>
<body onload="initialize()">
<div id="map_canvas" style="margin-left:100px;width:500px; height:
100%"></div>
</body>
</html>