|
|
第1行: |
第1行: |
− | <html>
| + | {{跳转|10|首页}} |
− | <script src="http://ditu.google.cn/maps?file=api&v=2.x&key=ABQIAAAAsec4RV8oAB2Dy0WfBAQeBRSeF8OSOK12RnhJK901ydzsR0THTBRE8kQzmJpyswMlPPfG9sTs3NQYLA&hl=zh-CN" 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(39.917, 116.397), 13);
| |
− | geocoder = new GClientGeocoder();
| |
− | }
| |
− | }
| |
− |
| |
− | function showAddress(address) {
| |
− | if (geocoder) {
| |
− | geocoder.getLatLng(
| |
− | address,
| |
− | function(point) {
| |
− | if (!point) {
| |
− | alert("不能解析: " + address);
| |
− | } else {
| |
− | map.setCenter(point, 13);
| |
− | var marker = new GMarker(point);
| |
− | map.addOverlay(marker);
| |
− | marker.openInfoWindowHtml(address);
| |
− | }
| |
− | }
| |
− | );
| |
− | }
| |
− | }
| |
− | </script>
| |
− |
| |
− | <body onload="initialize()" onunload="GUnload()">
| |
− | <form action="#" onsubmit="showAddress(this.address.value); return false">
| |
− | <p>
| |
− | <input type="text" size="60" name="address" value="武汉市江汉区" />
| |
− | <input type="submit" value="Go!" />
| |
− | </p>
| |
− | <div id="map_canvas" style="width: 500px; height: 300px"></div>
| |
− | </form>
| |
− | </body>
| |
− | </html>
| |