如何将Bing地图嵌入到带有描述性信息窗口的指向我的办公室地址的网站中?
最佳答案
这是一个例子:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Infobox set location</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script>
<script type="text/javascript">
var map = null;
function getMap()
{
map = new Microsoft.Maps.Map(document.getElementById('myMap'), {credentials: 'Your Bing Maps Key'});
}
function setInfoBoxLocation()
{
map.entities.clear();
var infoboxOptions = {width :200, height :100, showCloseButton: true, zIndex: 0, offset:new Microsoft.Maps.Point(10,0), showPointer: true, title:'Infobox Title', description:'Infobox description' };
var defaultInfobox = new Microsoft.Maps.Infobox(map.getCenter(), infoboxOptions );
map.entities.push(defaultInfobox);
defaultInfobox.setLocation(new Microsoft.Maps.Location(47.4, -122.33));
}
</script>
</head>
<body onload="getMap();">
<div id='myMap' style="position:relative; width:400px; height:400px;"></div>
<div>
<input type="button" value="SetInfoBoxLocation" onclick="setInfoBoxLocation();" />
</div>
</body>
</html>
以下是更多示例:http://www.bingmapsportal.com/ISDK/AjaxV7
关于php - 如何将Bing map 嵌入指向办公室位置的网站中?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/10031600/