0

在标记处使用图像时,我在谷歌地图上获取图像,但是当我对 infowindow 使用相同的图像时,它只显示 url。

代码:

var content = '<div class="map-content"><h3>' + "Account Name: " + "{!acc.Name} " + 
  '</h3>' + '<b>' +"Location: " + "{!acc.BillingCity}"  + '</b>' + '</br>'  +        
  "Direction : " + '<a href="http://maps.google.com/?daddr=' + "{!acc.BillingCity}" +  
  '" target="_blank">Get Directions</a>' +  "{!$Resource.Image_GoogleMap}"  +'</div>';

                    google.maps.event.addListener(marker, 'mouseover', function() {
                        infowindow.open(map, this); 
                        infowindow.setContent(content);
                    });

如何使用“{!$Resource.Image_GoogleMap}”在信息窗口显示谷歌地图的图像。谁能帮我?

4

1 回答 1

0

如果{!$Resource.Image_GoogleMap}是图像的 URL,并且您想在 InfoWindow 中显示它,请使用普通 HTM L:

<img src="{!$Resource.Image_GoogleMap}" alt="image description">

(注意正确匹配 ' 和 ")

var content = '<div class="map-content"><h3>' + "Account Name: " + "{!acc.Name} " + 
'</h3>' + '<b>' +"Location: " + "{!acc.BillingCity}"  + '</b>' + '</br>'  +        
"Direction : " + '<a href="http://maps.google.com/?daddr=' + "{!acc.BillingCity}" +  
'" target="_blank">Get Directions</a>' +  '<img src="{!$Resource.Image_GoogleMap}" alt="image description">'  +'</div>';
于 2013-09-16T15:08:40.917 回答