Google maps api 3 Google map v3-将url附加到iframe
我试图将URL附加到iframe,当单击事件侦听器时,我不确定这是否是正确的方法Google maps api 3 Google map v3-将url附加到iframe,google-maps-api-3,google-maps-markers,Google Maps Api 3,Google Maps Markers,我试图将URL附加到iframe,当单击事件侦听器时,我不确定这是否是正确的方法 var locations = [ ['Station 1', -32.77255333509087, 151.64851427078247, 1, www.url.com], ['Station 2', -32.75009, 151.73467000000405, 2, www.url.com], ['Station 3', -32.79854, 151.64355, 3, www.
var locations = [
['Station 1', -32.77255333509087, 151.64851427078247, 1, www.url.com],
['Station 2', -32.75009, 151.73467000000405, 2, www.url.com],
['Station 3', -32.79854, 151.64355, 3, www.url.com],
];
var marker, i;
for (i = 0; i < locations.length; i++) {
marker = new google.maps.Marker({
position: new google.maps.LatLng(locations[i][1], locations[i][2], url: place[4]),
map: map, icon: icon_station, animation: google.maps.Animation.BOUNCE
});
google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
$("#station_frame").attr("src", "URL Goes here?");
}
})(marker, i));
}
替换URL到这里?作者:
…它应该会起作用
注:
这部分代码是错误的,会导致语法错误:
new google.maps.LatLng(locations[i][1], locations[i][2], url: place[4])
它必须是:
new google.maps.LatLng(locations[i][1], locations[i][2])
new google.maps.LatLng(locations[i][1], locations[i][2])