🎜>
點擊這個按鈕,取得您的位置:
<script><BR>var x=document. getElementById("demo");<BR>function getLocation(){<BR> if(navigator.geolocation){<BR> navigator.geolocation.getCur> show alert("您的瀏覽器不支援地理定位");<BR> }<BR> }
<P>function showPosition(position){<BR> lat=position.coords.latitude;<BR> lon=position.coords.longitude;< / / 建立Map實例<BR> var point = new BMap.Point(lon, lat); // 建立點座標<BR> //map.centerAndZoom(point,15)); //map.enableScrollWheelZoom( ); <BR> var gc = new BMap.Geocoder(); <BR> gc.getLocation(point, function(rs){<BR> .province ", " addComp.city ", " addComp.district ", " addComp.street);<BR> });<BR> }<BR></script>