午夜无码人妻aⅴ大片色欲张津瑜,国产69久久久欧美黑人A片,色妺妺视频网,久久久久国产综合AV天堂

javascript獲取經緯度,網頁獲取經緯度

javascript中鼠標在地圖上的經緯度怎么獲取

自己寫有難度吧!?。?/p>

網站建設哪家好,找成都創(chuàng)新互聯(lián)公司!專注于網頁設計、網站建設、微信開發(fā)、成都微信小程序、集團企業(yè)網站建設等服務項目。為回饋新老客戶創(chuàng)新互聯(lián)還提供了清遠免費建站歡迎大家使用!

查看百度地圖api里頭有說明獲取實時經緯度的。

1、成為開發(fā)者,獲取百度地區(qū)秘鑰

2、引入百度地圖js插件

3、獲取經緯度

script type="text/javascript"

// 初始化地圖

var map = new BMap.Map("allmap");

var point = new BMap.Point(116.331398,39.897445);

map.centerAndZoom(point,12);

map.addEventListener("click", function(e){ //鼠標點擊事件

var pt = e.point;

alert(pt.lng + "xxx" + pt.lat)//彈窗經緯度

});/script

javascript 怎么獲得手機地理位置 比如經緯度

script

navigator.geolocation.getCurrentPosition(?//?該函數有如下三個參數

function(pos){?//?如果成果則執(zhí)行該回調函數

alert(

'??經度:'?+?pos.coords.latitude?+

'??緯度:'?+?pos.coords.longitude?+

'??高度:'?+?pos.coords.altitude?+

'??精確度(經緯):'?+?pos.coords.accuracy?+

'??精確度(高度):'?+?pos.coords.altitudeAccuracy?+

'??速度:'?+?pos.coords.speed

);

},?function(err){?//?如果失敗則執(zhí)行該回調函數

alert(err.message);

},?{?//?附帶參數

enableHighAccuracy:?false,?//?提高精度(耗費資源)

timeout:?3000,?//?超過timeout則調用失敗的回調函數

maximumAge:?1000?//?獲取到的地理信息的有效期,超過有效期則重新獲取一次位置信息

}

);

/script

參考?Lecaf 同學的博文

需要支持HTML5的瀏覽器才能支持

哪怕支持HTML5的瀏覽器支持也不一定很好

百度地圖--api--獲取經緯度

html xmlns=""

head

title根據地址查詢經緯度/title

meta http-equiv="Content-Type" content="text/html; charset=utf-8"

script type="text/javascript" src=""/script

/head

body style="background:#CBE1FF"

div style="width:730px;margin:auto;"? ?

? ? 要查詢的地址:input id="text_" type="text" value="寧波天一廣場" style="margin-right:100px;"/

? ? 查詢結果(經緯度):input id="result_" type="text" /

? ? input type="button" value="查詢" onclick="searchByStationName();"/

? ? div id="container"

? ? ? ? style="position: absolute;

? ? ? ? ? ? margin-top:30px;

? ? ? ? ? ? width: 730px;

? ? ? ? ? ? height: 590px;

? ? ? ? ? ? top: 50;

? ? ? ? ? ? border: 1px solid gray;

? ? ? ? ? ? overflow:hidden;"

? ? /div

/div

/body

script type="text/javascript"

var map = new BMap.Map("container");

map.centerAndZoom("寧波", 12);

map.enableScrollWheelZoom();? ? //啟用滾輪放大縮小,默認禁用

map.enableContinuousZoom();? ? //啟用地圖慣性拖拽,默認禁用

map.addControl(new BMap.NavigationControl());? //添加默認縮放平移控件

map.addControl(new BMap.OverviewMapControl()); //添加默認縮略地圖控件

map.addControl(new BMap.OverviewMapControl({ isOpen: true, anchor: BMAP_ANCHOR_BOTTOM_RIGHT }));? ?//右下角,打開

var localSearch = new BMap.LocalSearch(map);

localSearch.enableAutoViewport(); //允許自動調節(jié)窗體大小

function searchByStationName() {

map.clearOverlays();//清空原來的標注

var keyword = document.getElementById("text_").value;

localSearch.setSearchCompleteCallback(function (searchResult) {

? ? var poi = searchResult.getPoi(0);

? ? document.getElementById("result_").value = poi.point.lng + "," + poi.point.lat;

? ? map.centerAndZoom(poi.point, 13);

? ? var marker = new BMap.Marker(new BMap.Point(poi.point.lng, poi.point.lat));? // 創(chuàng)建標注,為要查詢的地方對應的經緯度

? ? map.addOverlay(marker);

? ? var content = document.getElementById("text_").value + "br/br/經度:" + poi.point.lng + "br/緯度:" + poi.point.lat;

? ? var infoWindow = new BMap.InfoWindow("p style='font-size:14px;'" + content + "/p");

? ? marker.addEventListener("click", function () { this.openInfoWindow(infoWindow); });

? ? // marker.setAnimation(BMAP_ANIMATION_BOUNCE); //跳動的動畫

});

localSearch.search(keyword);

}

/script

/html

分享題目:javascript獲取經緯度,網頁獲取經緯度
標題URL:http://www.ekvhdxd.cn/article18/dsesodp.html

成都網站建設公司_創(chuàng)新互聯(lián),為您提供虛擬主機、定制網站、微信公眾號、軟件開發(fā)外貿網站建設、關鍵詞優(yōu)化

廣告

聲明:本網站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)

成都定制網站建設