function showAddress() { var address="辽宁省营口市"; //获取字段的值 map = new GMap2(document.getElementById("mymap")); geocoder = new GClientGeocoder(); if (geocoder) { geocoder.getLatLng( address, function(point) { map.setCenter(point, 13); //缩放的级别,数字越大精度越高,最高不超过22,建议设置13到15 var marker = new GMarker(point); map.addOverlay(marker); //显示地图标记 marker.openInfoWindowHtml(address); map.addControl(new GSmallMapControl());//显示地图缩放控制条,此处为小控制条. map.enableDoubleClickZoom(); //支持双击缩放 } ); } } window.onload=showAddress;