
Simple onClick listener
By:
html5devs on
May 7th, 2012 | syntax:
HTML 5 | size: 0.89 KB | hits: 25 | expires: Never
<!DOCTYPE html>
<html>
<head>
<title>Google Maps On Click Listener</title>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
function initialize() {
var mapDiv = document.getElementById('map-canvas');
var map = new google.maps.Map(mapDiv, {
center: new google.maps.LatLng(37.4419, -122.1419),
zoom: 13,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
}
google.maps.event.addDomListener(window, 'load', initialize);
google.maps.event.addDomListener(window,'click',
function(){
window.location = 'http://www.google.com';
}
);
</script>
</head>
<body style="font-family: Arial; border: 0 none;">
<div id="map-canvas" style="width: 500px; height: 400px"></div>
</body>
</html>