1
我需要顯示標記,如果複選框被選中 和隱藏如果未選中谷歌地圖切換標記
function initialize() {
//map
var UCM = new google.maps.LatLng(37.366572, -120.424876);
var myOptions = {
zoom : 13,
center : UCM,
mapTypeId : google.maps.MapTypeId.ROADMAP
};
//streetview
var panoramaOptions = {
position : UCM,
pov : {
heading : 0,
pitch : 0,
zoom : 0
}
};
var panorama = new google.maps.StreetViewPanorama(document
.getElementById("pano"), panoramaOptions);
var map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
map.setStreetView(panorama);
//bus stops
var GLaps = new google.maps.LatLng(37.315284, -120.505021);
var infowindow = new google.maps.InfoWindow(
{
content : '<br>GRANVILLE LUXURY APARTMENTS </br>' + '<br><b><FONT COLOR="#0000FF">C1 BLUE LINE</FONT></b>:(AM) 6:45, 8:05, 9:25, 10:45; (PM)12:05, 1:25, 2:45, 4:05, 5:25, 6:45, 8:05</br>' + '<br><b><FONT COLOR="cccc00">C1 GOLD LINE</FONT></b>: (AM) 7:25, 8:45, 10:05, 11:25; (PM) 12:45, 2:05, 3:25, 4:45, 6:05, 7:25, 8:45, 10:05</br>'
});
var marker = new google.maps.Marker({
position : GLaps,
draggable : false,
map : map,
title : 'Granville Luxury Apartments Departure Times',
clickable : true
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map, marker);
});
}
請使用代碼格式化工具! – ScottE 2010-12-06 01:04:19
修復了代碼格式問題,但我仍然不確定問題是什麼。 – Hamish 2010-12-06 01:25:20