无法打印每个地址的地图

以下是Google Map Api 3的示例。

在正文的底部,它还包括jquery文件和下面这个

 

HTML

 
San Francisco
San Diego
San Jose

JQuery的

 var map; var geocoder = new google.maps.Geocoder(); function initialize() { var mapOptions = { zoom: 9, panControl: false, streetViewControl: false, mapTypeControl: false } map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions); } var address = $(".address"); var el; address.each(function(){ el = $(this).text(); codeAddress(el); }); function codeAddress(address) { alert(address); geocoder.geocode( { 'address': address }, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { map.setCenter(results[0].geometry.location); var marker = new google.maps.Marker({ map: map, position: results[0].geometry.location }); } else { alert('Geocode was not successful for the following reason: ' + status); } }); } google.maps.event.addDomListener(window, 'load', initialize); 

我第一次尝试使用googleMap Api 3 – 我四处寻找答案。

每个表行中都会打印出动态多个地址。 因此从div.address中获取每个地址,并将每个地址转换为纬度和经度,然后显示地图。

但是现在,在使用定位标记显示地图之前,它不会检查每个地址或循环所有地址以转换为纬度和经度。

为什么不循环每个地址? 有没有办法从div.address中获取和循环地址作为文本并将其转换为显示地图?

JSFIDDLE DEMO

正如你所看到的,jsfiddle上出现了1个不正确的地图:(

更新了#1

管理以使所有标记显示一个地图,但仍然无法为每个地址的每个标记获得3个单独的地图 。 无法理解为什么它只在第一行打印一个带有标记的地图。

如果有的话,感谢他们的帮助和见解

请帮忙