新手问个geocode的问题
我想将下面代码中获取的经纬度信息转换成具体的地址信息显示在地图下面空白处,对于geocode这个函数不太懂,哪位大神教教或者将那段代码插入我的代码中程序代码:
<!DOCTYPE html> <html> <head> <title>Device Properties Example</title> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <script type="text/javascript" src="http://maps. type="text/javascript" charset="utf-8"> var lat; var lng; var watchID = null; function onDeviceReady() { var options = { frequency: 10000 }; watchID = navigator.geolocation.watchPosition(onSuccess, onError, options); } function onSuccess(position) { lat = position.coords.latitude; lng = position.coords.longitude; var element = document.getElementById('geolocation'); element.innerHTML = 'Latitude: ' + lat + '<br />' + 'Longitude: ' + lng + '<br />' + '<hr />' + element.innerHTML; initialize(); } function clearWatch() { if (watchID != null) { navigator.geolocation.clearWatch(watchID); watchID = null; } } function onError(error) { alert('code: ' + error.code + '\n' + 'message: ' + error.message + '\n'); } function initialize() { var myLatlng = new google.maps.LatLng(lat,lng); var myOptions = { zoom: 14, center: myLatlng, mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); var marker = new google.maps.Marker({position:myLatlng,map:map,title:"CurrentPosition" }); } </script> </head> <body onload = "onDeviceReady();"> <div id="map_canvas" style="height:400px;"></div> <br><div id="geolocation">Watching geolocation...</div></br> <button onclick="clearWatch();">Clear Watch</button> </body> </html>