<script src='http://maps.google.com/maps?file=api&v=2&key=ABQIAAAATB4WHBfI6bn_r2yHC5-cShQUwb554zi4F9w6VUOuAIqhCjZSuhSasJwxZuyueyW2ctbO3M8TQaJBIA' type='text/javascript'></script><script type='text/javascript'>
//<![CDATA[
function load() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById('map'));
GEvent.addListener(map, 'moveend', function() {
var center = map.getCenter();
document.getElementById('message').innerHTML = center.toString();
});
map.addControl(new GSmallMapControl()); //
map.addControl(new GMapTypeControl()); //
map.setCenter(new GLatLng(55.752,37.616), 10);
var Moscow_point = new GLatLng(55.752,37.616);
var Moscow = new GMarker(Moscow_point, {title: 'Moscow'});
map.addOverlay(Moscow);
}
}
//]]>
</script>
</head>
<body onload='load()' onunload='GUnload()'>
<div id='map' style='width: 100%; height: 300px'></div>
</body>
Here is live example: http://travel.demas.me Why can't I see 开发者_JAVA技巧the marker?
I'm seeing this error through Chrome's Developer Tools:
travel.demas.me:14 Uncaught TypeError: Cannot set property 'innerHTML' of null
On this line:
document.getElementById('message').innerHTML = center.toString();
Try removing this for debugging purposes.
精彩评论