我有一个要添加到标记 stagleton.png 的图像,并且我有一个创建标记的函数。如何更改 InfoWindow 方法,以便图像也与 InfoWindow 中的文本一起显示?
function createMarker(name, latlng, mapsent)
{
var marker = new google.maps.Marker({
position: latlng,
map: mapsent,
title: name
});
marker.info = new google.maps.InfoWindow({
//when I add <IMG BORDER="0" ALIGN="Left" SRC="stagleton.jpg"> the maps will not load
content: <IMG BORDER="0" ALIGN="Left" SRC="stagleton.jpg"> "My name is " + name
});
google.maps.event.addListener(marker, 'click', function(){
marker.info.open(mapsent, marker);
});
return marker;
}
最佳答案
尝试:
content: '<IMG BORDER="0" ALIGN="Left" SRC="stagleton.jpg"> My name is ' + name
关于javascript - 如何将图像添加到谷歌地图 v3 中标记的信息窗口?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10161013/