我想使用谷歌地图 API v3 和信息框来显示多个标签,但在谷歌地图上没有标记。我搜索了 stackoverflow 和网络,但只找到了显示标记和标签的示例。
基本代码来自谷歌地图实用程序库1
代码是:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0098)http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/examples/infobox-label.html -->
<HTML><HEAD><TITLE>Creating a Map Label with InfoBox</TITLE>
<META content="text/html; charset=windows-1252" http-equiv=Content-Type>
<SCRIPT type=text/javascript
src="Creating%20a%20Map%20Label%20with%20InfoBox_files/js"></SCRIPT>
<SCRIPT type=text/javascript
src="Creating%20a%20Map%20Label%20with%20InfoBox_files/infobox.js"></SCRIPT>
<SCRIPT type=text/javascript>
function initialize() {
var secheltLoc = new google.maps.LatLng(49.47216, -123.76307);
var myMapOptions = {
zoom: 15,
center: secheltLoc,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"), myMapOptions);
var labelText = "City Hall";
var labelText2 = "where";
var myOptions = {
content: labelText
,boxStyle: {
border: "1px solid #0080FF"
,textAlign: "center"
,color: "#0080FF"
,background: "white"
,fontSize: "11pt"
,width: "90px"
}
,disableAutoPan: true
,pixelOffset: new google.maps.Size(-25, 0)
,position: secheltLoc
,closeBoxURL: ""
,isHidden: false
,pane: "mapPane"
,enableEventPropagation: true
};
var ibLabel = new InfoBox(myOptions);
ibLabel.open(map);
}
</SCRIPT>
<META name=GENERATOR content="MSHTML 8.00.7601.17514"></HEAD>
<BODY onload=initialize()>
<DIV style="WIDTH: 100%; HEIGHT: 400px" id=map_canvas></DIV>
</BODY>
</HTML>
请问如何更改代码以显示多个标签?我是 Javascript 和 Google API 的新手