,,,,,,,,,,,,,,,,,,<强> 强>
& lt; ! DOCTYPE html> & lt; html  lang=癳n”比; & lt; head> ,,,& lt; meta charset=皍tf - 8”比; ,,,& lt; title> HTML5定位& lt;/title> ,,,& lt; script type=" text/javascript, src=" http://lib.sinaapp.com/js/jquery/1.7.2/jquery.min.js "祝辞& lt;/script> & lt;才能script type=" text/javascript, src=" http://api.map.baidu.com/api?v=2.0& ak=wqBXfIN3HkpM1AHKWujjCdsi "祝辞& lt;/script> & lt;才能script type=" text/javascript, src=" http://developer.baidu.com/map/jsdemo/demo/convertor.js "祝辞& lt;/script> ,,,& lt; style type=" text/css "比; ,,,*{,保证金:0 px;,填充:,0 px;} 身体才能{text-align:中心;,,身高:,100%;溢出:隐藏;} #才能allmap{,宽度:100%;高度:,100%;,位置:,绝对;} ,,,& lt;/style> & lt;/head> & lt; body> ,,,& lt; div id=癮llmap祝辞& lt;/div> & lt; script type=" text/javascript祝辞 ,$(函数(){ ,,,,如果(supportsGeoLocation ()) { ,,,,,,,,警报(“你的浏览器支持,地理位置。”); ,,,,其他}{ ,,,,,,,,警报(“不支持,地理位置。”) ,,,,}//才能,检测浏览器是否支持HTML5 ,,,,,,,,,,,,,,function supportsGeoLocation () { ,,,,,,,,,,,,,,,,,return ! ! navigator.geolocation; ,,,,,,,,,,,,,},,//才能,单次位置请求执行的函数,,,,,,,,,,,,, ,,,,,,,,,,,,,,function getLocation () { ,,,,,,,,,,,,,,,,,navigator.geolocation.getCurrentPosition (mapIt locationError); ,,,,,,,,,,,,,,}//才能定位成功时,执行的函数 ,,,,,,,,,,,,,function mapIt{(位置), ,,,,,,,,,,,,,,,var lon =, position.coords.longitude; ,,,,,,,,,,,,,,,,,,var lat =, position.coords.latitude; ,,,,,,,,,,,,,,,,,,//,警报(“您位置的经度是:”+朗+”,纬度是:”+ lat); ,,,,,,,,,,,,,,,var map =, new BMap.Map (“allmap”); ,,,,,,,,,,,,,,,var point =, new BMap.Point(" +朗+“”,“”+ lat + " "); ,,,,,,,,,,,,,,,map.centerAndZoom(点、19); ,,,,,,,,,,,,,,,var gc =, new BMap.Geocoder (); ,,,,,,,,,,,,,,,,,,,,,translateCallback =, function (点){ ,,,,,,,,,,,,,,,,,,,,,,,,,var marker =, new BMap.Marker(点); ,,,,,,,,,,,,,,,,,,,,,,,,,map.addOverlay(标记); ,,,,,,,,,,,,,,,,,,,,,,,,,map.setCenter(点); ,,,,,,,,,,,,,,,,,,,,,,,,,gc.getLocation(点,函数(rs) { ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,var addComp =, rs.addressComponents; null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null利用HTML5定位功能,实现在百度地图上定位