1. Project requirements such as topics
2. Nonsense not to say---code as follows:
"Content-type"Content="text/html; Charset=utf-8"/> <meta name="Viewport"Content="initial-scale=1.0, User-scalable=no"/> <style type="Text/css">body, HTML, #allmap {width: -%;height:500px;overflow:hidden;margin:0; Font-family:"Microsoft Ya-Black";} </style> <script type="Text/javascript"Src="http://api.map.baidu.com/api?v=2.0&ak=DD279b2a90afdf0ae7a3796787a0742e"></script> <title> Browser targeting </title>"Allmap"></div> <div style="width:auto;height:55px; '"> <input type="text"Id="Locate"style="Background-color:pink;"Placeholder="Address"/> <input type="Button"Value="Determine"style="Background-color:blue;"/> </div></body>"Text/javascript">//Baidu Map API features varMap =NewBmap.map ("Allmap"); varPoint =NewBmap.point (116.331398,39.897445); Map.centerandzoom (Point, A); //add a callout to a map varGeolocation =Newbmap.geolocation (); Geolocation.getcurrentposition (function (r) {varmk =NewBmap.marker (R.point); if( This. getStatus () = =bmap_status_success) {Map.addoverlay (MK); Map.panto (R.point); Map.addeventlistener ('ondragging', function () {mk.setposition (Map.getcenter ()); }); //get MK latitude and longitude after the map stops movingMap.addeventlistener ('MoveEnd', function () {varpos =mk.getposition (); Console.log (POS); //creating an Address resolution object varGEOC =NewBmap.geocoder (); Geoc.getlocation (POS, function (RS) {varAddcomp =rs.addresscomponents; Alert (addcomp.province+", "+ addcomp.city +", "+ Addcomp.district +", "+ Addcomp.street +", "+addcomp.streetnumber); }); }) //Console.log (POS);Alert'you are here:'+r.point.lng+','+R.point.lat); } Else{alert ('failed'+ This. GetStatus ()); }},{enablehighaccuracy:true}) //About Status Codes//bmap_status_success retrieved successfully. Corresponds to the value "0". //bmap_status_city_list City list. Corresponds to the value "1". //bmap_status_unknown_location location result unknown. Corresponds to the value "2". //Bmap_status_unknown_route navigation results are unknown. Corresponds to the value "3". //bmap_status_invalid_key illegal keys. Corresponds to the value "4". //bmap_status_invalid_request illegal request. Corresponds to the value "5". //bmap_status_permission_denied does not have permissions. Corresponds to the value "6". (added since 1.1)//The bmap_status_service_unavailable service is not available. Corresponds to the value "7". (added since 1.1)//bmap_status_timeout Timeout. Corresponds to the value "8". (added since 1.1)</script>
3. If you find this article useful, welcome to the grand prize--
Call Baidu map API Mobile map Maker always in the middle of the map and according to the editor latitude and longitude return address