[求建议]关于Google地图 要做一个地图显示系统,通过文本框输入一个地址,在Google地图上显示出来,请问如何获得输入地址所对应Google地图上的坐标,请大家帮忙.... 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用geocoder<%-- Document : Maptry Created on : Jul 15, 2009, 10:18:33 AM Author : Vera--%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml"> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> <title>Google Maps JavaScript API Example: Reverse Geocoder</title> <script src="http://maps.google.com/maps?file=api&v=2&sensor=true&key=ABQIAAAAmmpqvETboXNAa3pdbxsU4xQ-h6LmbbFeFeD785htAuKkPrGfChQpyRPJjOe8P7q0fPhC2LazlVYbmg" type="text/javascript"></script> <script type="text/javascript"> var map = null; var geocoder = null; function initialize() { if (GBrowserIsCompatible()) { map = new GMap2(document.getElementById("map_canvas")); map.setCenter(new GLatLng(1.2462668, 103.8289017), 13); geocoder = new GClientGeocoder(); } }function showAddress(address) { if (geocoder) { geocoder.getLatLng( address, function(point) { if (!point) { alert(address + " not found"); } else { map.setCenter(point, 13); var er = new GMarker(point); map.addOverlay(er); er.openInfoWindowHtml( '<b>orig latlng:</b>' + response.name + '<br/>' + '<b>latlng:</b>' + place.Point.coordinates[1] + "," + place.Point.coordinates[0] + '<br>' + '<b>Status Code:</b>' + response.Status.code + '<br>' + '<b>Status Request:</b>' + response.Status.request + '<br>' + '<b>Address:</b>' + place.address + '<br>' + '<b>Accuracy:</b>' + place.AddressDetails.Accuracy + '<br>' + '<b>Country code:</b> ' + place.AddressDetails.Country.CountryNameCode); } } ); } } </script> </head> <body onload="initialize()" onunload="GUnload()"> <form action="#" onsubmit="showAddress(this.address.value); return false"> <p> <input type="text" size="60" name="address" value="1600 Amphitheatre Pky, Mountain View, CA" /> <input type="submit" value="Go!" /> </p> <div id="map_canvas" style="width: 500px; height: 300px"></div> </form> </body></html>你可以去GOOGLE找,有很多的例子 用jquery将textarea的值放入Array()中 js文件大小问题 关于在页面存储变量。。 大家帮看下这断代码为什么管用.. 一个简单的text问题 100分求教高手:如何把一个div层从frameset下的一个frame随鼠标托动到另一个frame中。 如何解码t=eval("String.fromCharCode("+t+")"); iframe问题 在线等 img 为什么不显示 关于js中内存分配的一些疑惑 IE8.0中显示不出来图片其他浏览器都可以显示 如何让它确定的情况下做地址跳转
Document : Maptry
Created on : Jul 15, 2009, 10:18:33 AM
Author : Vera
--%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Google Maps JavaScript API Example: Reverse Geocoder</title>
<script src="http://maps.google.com/maps?file=api&v=2&sensor=true&key=ABQIAAAAmmpqvETboXNAa3pdbxsU4xQ-h6LmbbFeFeD785htAuKkPrGfChQpyRPJjOe8P7q0fPhC2LazlVYbmg"
type="text/javascript"></script>
<script type="text/javascript"> var map = null;
var geocoder = null; function initialize() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(1.2462668, 103.8289017), 13);
geocoder = new GClientGeocoder();
}
}function showAddress(address) {
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (!point) {
alert(address + " not found");
} else {
map.setCenter(point, 13);
var er = new GMarker(point);
map.addOverlay(er);
er.openInfoWindowHtml(
'<b>orig latlng:</b>' + response.name + '<br/>' +
'<b>latlng:</b>' + place.Point.coordinates[1] + "," + place.Point.coordinates[0] + '<br>' +
'<b>Status Code:</b>' + response.Status.code + '<br>' +
'<b>Status Request:</b>' + response.Status.request + '<br>' +
'<b>Address:</b>' + place.address + '<br>' +
'<b>Accuracy:</b>' + place.AddressDetails.Accuracy + '<br>' +
'<b>Country code:</b> ' + place.AddressDetails.Country.CountryNameCode);
}
}
);
}
}
</script>
</head> <body onload="initialize()" onunload="GUnload()">
<form action="#" onsubmit="showAddress(this.address.value); return false">
<p>
<input type="text" size="60" name="address" value="1600 Amphitheatre Pky, Mountain View, CA" />
<input type="submit" value="Go!" />
</p>
<div id="map_canvas" style="width: 500px; height: 300px"></div>
</form> </body>
</html>你可以去GOOGLE找,有很多的例子