Marco Hsu Posted April 11, 2021 Share Posted April 11, 2021 unimhtmlframe.html= <div id="allmap"></div> <span id="curraddress"></span> <script type="text/javascript"> var map = new BMap.Map("allmap"); var point = new BMap.Point(120.61990712, 31.31798737); map.centerAndZoom(point, 17); var pointAttendance; var geolocation = new BMap.Geolocation(); geolocation.getCurrentPosition(function (r) { if (this.getStatus() == BMAP_STATUS_SUCCESS) { var mk = new BMap.Marker(r.point); map.addOverlay(mk); map.panTo(r.point); point = new BMap.Point(r.point.lng, r.point.lat); var geoc = new BMap.Geocoder({extensions_town: true}); geoc.getLocation(point, function (result) { if (result){ document.getElementById("curraddress").innerHTML = result.address } }); } else { alert('failed' + this.getStatus()); } }, { enableHighAccuracy: true }) </script> <style> #allmap { width: 100%; height: 200px; } </style> I want to read the 【curraddress】 value to unimlabel.caption ; what can i do? Link to comment Share on other sites More sharing options...
Recommended Posts