无法在谷歌地图上设置标记
<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>
这是实例:http://travel.demas.me 为什么我看不到标记?
<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 the marker?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我通过 Chrome 的开发者工具看到此错误:
在此行上:
尝试删除此行以进行调试。
I'm seeing this error through Chrome's Developer Tools:
On this line:
Try removing this for debugging purposes.