我的Google地圖運行良好。我一直試圖只讓一個infowindow立即打開,並在這樣做的過程中破壞了我的代碼。在這一點上,我無法恢復到工作階段。我經歷了十幾次代碼,找不到任何問題。我正在將我的更改放在stackoverflow論壇上的this article上。Google地圖:進行了更改,現在地圖不會加載
<script type="text/javascript">
function initialize() {
var infowindow new google.maps.InfoWindow();
var LatLng = new google.maps.LatLng(38.89, -92.343);
var myOptions = {
zoom: 13,
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: LatLng
};
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var bounds = new google.maps.LatLngBounds();
var Image = "images/wrenchIcon.png";
var Content = "blank";
var Head = "The Falls";
var cMarker = new google.maps.Marker({
position: LatLng,
map: map,
title: Head,
icon: Image
})
google.maps.event.addListenter(cMarker, 'click', function() {
infowindow.setContent(Content);
infowindow.open(map, cMarker);
});
Image = "images/goodIcon.png";
LatLng = new google.maps.LatLng(38.912, -92.301);
Content = "blank";
Head = "Bob TheBuilder";
var marker1 = new google.maps.Marker({
position: LatLng,
map: map,
title: Head,
icon: Image
});
google.maps.event.addListenter(marker1, 'click', function() {
infowindow.setContent(Content);
infowindow.open(map, marker1);
});
bounds.extend(LatLng);
Image = "images/alertYelIcon.png";
LatLng = new google.maps.LatLng(38.951, -92.332);
Content = "blank";
Head = "Shiloh Bar&Grill";
var marker2 = new google.maps.Marker({
position: LatLng,
map: map,
title: Head,
icon: Image
});
google.maps.event.addListenter(marker2, 'click', function() {
infowindow.setContent(Content);
infowindow.open(map, marker2);
});
bounds.extend(LatLng);
Image = "images/goodIcon.png";
LatLng = new google.maps.LatLng(38.92, -92.332);
Content = "blank";
Head = "FlatBranch Pub";
var marker3 = new google.maps.Marker({
position: LatLng,
map: map,
title: Head,
icon: Image
});
google.maps.event.addListenter(marker3, 'click', function() {
infowindow.setContent(Content);
infowindow.open(map, marker3);
});
bounds.extend(LatLng);
</script>
我知道這篇文章是非常具體的,但任何你可以做的事情都會有所幫助,我要把我的頭撞在牆上。 – atk3kf