1
我想寫在infowindow內容,我的循環的記錄號。
結果是,我讀了每個infowindow的最後一個記錄號(10),而不是1,2,3 ... 10
有人可以幫助我嗎?在此先感謝
的代碼是這樣的:
谷歌api v3 infowindow與多個標記不起作用
function generaMappaMulti() {
var CoordinataIniziale = new google.maps.LatLng(44.714957, 10.733647); //set initial coordinate
var opzioni = { center: CoordinataIniziale, zoom: 10, mapTypeId: google.maps.MapTypeId.ROADMAP }; //set options to the map
map = new google.maps.Map(document.getElementById("canvas_mappa"), opzioni);
[...]
for (var i = 0; i < 10; i += 1) { //for each row...
var Coordinate = new google.maps.LatLng(ObjLat, ObjLon);
marker = new google.maps.Marker({ position: Coordinate, map: map}); //add a marker to the map
var infowindow = new google.maps.InfoWindow({
content: i.toString() //here is where i'm trying to write record number on the infowindows
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map, this);
});
}
}
google.maps.event.addDomListener(window, 'load', initialize);