3
A
回答
5
你可能要考虑使用Google Maps API,作为davek already suggested。
以下示例可帮助您入门。您需要做的就是将JavaScript变量userLocation
更改为用户从您提到的下拉字段中选择的位置。
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Google Maps API Demo</title>
<script src="http://maps.google.com/maps?file=api&v=2&sensor=false"
type="text/javascript"></script>
</head>
<body onunload="GUnload()">
<div id="map_canvas" style="width: 400px; height: 300px"></div>
<script type="text/javascript">
var userLocation = 'London, UK';
if (GBrowserIsCompatible()) {
var geocoder = new GClientGeocoder();
geocoder.getLocations(userLocation, function (locations) {
if (locations.Placemark)
{
var north = locations.Placemark[0].ExtendedData.LatLonBox.north;
var south = locations.Placemark[0].ExtendedData.LatLonBox.south;
var east = locations.Placemark[0].ExtendedData.LatLonBox.east;
var west = locations.Placemark[0].ExtendedData.LatLonBox.west;
var bounds = new GLatLngBounds(new GLatLng(south, west),
new GLatLng(north, east));
var map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));
map.addOverlay(new GMarker(bounds.getCenter()));
}
});
}
</script>
</body>
</html>
以上例子将呈现图像下面的一个:
的地图将不会显示,如果Google Client-side Geocoder不能retreive根据输入的地址的坐标。
2
查看Google Maps API。这里有很多信息和几个例子:不了解更多关于你的环境/需求的信息,它很难更具体。
相关问题
- 1. 如何在我的网站上添加Google搜索?
- 2. 如何在默认Google地图上添加叠加地图?
- 3. 如何在Google Cloud中添加我的网站列表
- 4. Google地图v3未呈现在我的jsf 2网站上
- 5. 无法让Google地图显示在我的网站上。
- 6. 如何在我的网站添加iframe
- 7. 如何获取嵌入在我网站上的Google地图的URL?
- 8. 如何在网站上创建自定义Google地图?
- 9. 如何将集成的Google搜索添加到我的网站?
- 10. 如何在Google地图上添加本地搜索?
- 11. 无法在Google App Engine网站上添加图片
- 12. 如何在网站上建立地图
- 13. 在Android上添加Google地图对象
- 14. 在标记上添加infoWindow Google地图
- 15. 在Google地图上添加标记
- 16. 如何在Google地图上自动填写/建议我的网站上的地点(含地址)?
- 17. 使用MapInnovations将Google地图添加到网站
- 18. 如何在网页中安排div如google地图或其他地图网站
- 19. 如何在Firefox中为我的网站定制“添加网站”图片?
- 20. 如何在Google网站上创建文件夹并添加/更新Javascript(对我的网站使用jQuery框架)?
- 21. 如何在我开发的网站上添加链接?
- 22. 如何在我的网站上添加Follow - UnFollow按钮?
- 23. 如何在我的网站上添加twitter按钮?
- 24. 如何在我的网站上使用bing地图?
- 25. 如何在网站上添加编辑现场网站?
- 26. 如何在公共网站上找到网站页面添加
- 27. 动态网站上的网站地图
- 28. 将图标添加到我的网站
- 29. 如何在Google地图Pinpoint上添加标签?
- 30. 如何在Google地图上添加html表单?
我们可以看到一些代码吗?或更多的背景?或两者? – 2010-04-12 19:38:49