目錄
" + (i + 1) + ". " + d.name + "" > " + (i + 1) + ". " + d.name + "
名称: " + poiArr[i].name + "" >名称: " + poiArr[i].name + "
首頁 web前端 html教學 高德地图根据关键词坐标拾取小工具_html/css_WEB-ITnose

高德地图根据关键词坐标拾取小工具_html/css_WEB-ITnose

Jun 24, 2016 am 11:57 AM
關鍵字 地圖 座標 小工具

今天早上在写代码的时候,需要用到地图坐标拾取工具,我们用的是搞的地图,在高德地图API官方网站中没有找到相关的坐标拾取工具。在网上找到这么个小工具,与大家分享下!

CSS

 1  html { background-color: #fff; } 2         body, div, h1, h2, h3, h4, ul, li, form, input, dl, dt, dd, p { margin: 0; padding: 0; font-family: 微软雅黑; } 3         h3 { +font-size:14px; _font-size: 14px; } 4         img { border: none; } 5         .c { clear: both; } 6         ul, ol, li { list-style: none; } 7         .clearfix:after { content: "."; visibility: hidden; display: block; height: 0; overflow: hidden; clear: both; } 8         * html .clearfix { height: 1%; } 9         * + html .clearfix { height: 1%; }10         body { font: 12px/1.5em 微软雅黑,Arial,Verdana,Helvetica,sans-serif; color: #333; }11         button, input, select, textarea { color: #999; }12         input[type="button"] { padding: 0 5px; color: #333; }13         .demo_box { width: 360px; }14         #iCenter { width: 100%; height: 100%; border: 1px solid #F6F6F6; }15         #r_title { line-height: 28px; padding-left: 5px; background-color: #D1EEEE; font-weight: bold; }16         #result { overflow: auto; margin-bottom: 5px; /*    width:661px;*/ height: 500px; }17         #result .sub_result { font-size: 12px; cursor: pointer; line-height: 20px; /*padding:0px 0 4px 2px;*/ border-bottom: 1px solid #C1FFC1; }18         #result .sub_result .detail { }19         #result .sub_result .detail h3 { color: #00A6AC; }20         a { color: #067EC0; text-decoration: none; }21         a:hover { text-decoration: underline; }22         .note { color: #999; }23         div.change { background-image: url(http://pages.haozu.ajkcdn.com/20110909/img/map/marker-h.png); }24         div.change div { background-image: url(http://pages.haozu.ajkcdn.com/20110909/img/map/marker-h-l.gif); }25         .markerContentStyle { position: relative; }26         .markerContentStyle span { background-color: #FFFFFF; color: #FF1493; width: 120px; heigth: 80px; border: 2px solid #D8BFD8; FONT-FAMILY: 华文行楷; position: absolute; top: -10px; left: 25px; white-space: nowrap -webkit-border-radius:5px; border-radius: 5px; }27         div.info { position: relative; z-index: 100; border: 1px solid #BCBCBC; box-shadow: 0 0 10px #B7B6B6; border-radius: 8px; background: rgb(255,255,255); /* The Fallback */ background-color: rgba(255,255,255,0.9); transition-duration: 0.25s; }28         div.info:hover { box-shadow: 0px 0px 15px #0CF; }29         div.info-top { position: relative; background: none repeat scroll 0 0 #F9F9F9; border-bottom: 1px solid #CCC; border-radius: 5px 5px 0 0; }30         div.info-top div { display: inline-block; color: #333333; font-size: 14px; font-weight: bold; line-height: 31px; padding: 0 10px; }31         div.info-top img { position: absolute; top: 10px; right: 10px; transition-duration: 0.25s; }32         div.info-top img:hover { box-shadow: 0px 0px 5px #000; }33         div.info-middle { font-size: 12px; padding: 10px; line-height: 21px; }34         div.info-bottom { height: 0px; width: 100%; clear: both; text-align: center; }35         div.info-bottom img { position: relative; z-index: 104; }36         table { height: 100%; }37         html, body { height: 100%; margin: 0px; padding: 0px; }38         .STYLE1 { color: #F3F3F3; }
登入後複製

JS

 1 var mapObj; 2         var marker = new Array(); 3         var windowsArr = new Array(); 4         //基本地图加载 5         function mapInit() { 6             mapObj = new AMap.Map("iCenter"); 7             //AMap.event.addListener(mapObj,'click',getLnglat); 8         } 9         function placeSearch() {10             var MSearch;11             mapObj.plugin(["AMap.PlaceSearch"], function () {12                 MSearch = new AMap.PlaceSearch({ //构造地点查询类13                     pageSize: 10,14                     pageIndex: 1,15                     city: "021" //城市16                 });17                 AMap.event.addListener(MSearch, "complete", keywordSearch_CallBack);//返回地点查询结果18                 var searchName = document.all.searchText.value;//查询关键字19                 MSearch.search(searchName); //关键字查询20             });21         }22         //添加marker&infowindow23         function addmarker(i, d) {24             var lngX = d.location.getLng();25             var latY = d.location.getLat();26             var markerOption = {27                 map: mapObj,28                 icon: "http://webapi.amap.com/images/" + (i + 1) + ".png",29                 position: new AMap.LngLat(lngX, latY)30             };31 32             var mar = new AMap.Marker(markerOption);33             marker.push(new AMap.LngLat(lngX, latY));34 35             var infoWindow = new AMap.InfoWindow({36                 content: "<h3 id="font-color-a-ac-i-d-name-font"><font color=\"#00a6ac\">  " + (i + 1) + ". " + d.name + "</font></h3>" + TipContents(d.type, d.address, d.tel),37                 size: new AMap.Size(300, 0),38                 autoMove: true,39                 offset: new AMap.Pixel(0, -30)40             });41             windowsArr.push(infoWindow);42             var aa = function (e) { infoWindow.open(mapObj, mar.getPosition()); };43             AMap.event.addListener(mar, "click", aa);44             AMap.event.addListener(mar, 'click', getLnglat);45         }46         //回调函数47         function keywordSearch_CallBack(data) {48             var resultStr = "";49             var poiArr = data.poiList.pois;50             var resultCount = poiArr.length;51             for (var i = 0; i < resultCount; i++) {52                 resultStr += "<div id='divid" + (i + 1) + "' onclick='openMarkerTipById1(" + i + ",this)' onmouseout='onmouseout_MarkerStyle(" + (i + 1) + ",this)' style=\"font-size: 12px;cursor:pointer;padding:0px 0 4px 2px; border-bottom:1px solid #C1FFC1;\"><table><tr><td><img  src="/static/imghw/default1.png"  data-src="http://webapi.amap.com/maps?v=1.2&key=XXXXXXX"  class="lazy"  src=\"http://webapi.amap.com/images/" + (i + 1) + ".png\" alt="高德地图根据关键词坐标拾取小工具_html/css_WEB-ITnose" ></td>" + "<td><h3 id="font-color-a-ac-名称-poiArr-i-name-font"><font color=\"#00a6ac\">名称: " + poiArr[i].name + "</font></h3>";53                 resultStr += TipContents(poiArr[i].type, poiArr[i].address, poiArr[i].tel) + "</td></tr></table></div>";54                 addmarker(i, poiArr[i]);55             }56             mapObj.setFitView();57             document.getElementById("result").innerHTML = resultStr;58 59         }60         function TipContents(type, address, tel) {  //窗体内容61             if (type == "" || type == "undefined" || type == null || type == " undefined" || typeof type == "undefined") {62                 type = "暂无";63             }64             if (address == "" || address == "undefined" || address == null || address == " undefined" || typeof address == "undefined") {65                 address = "暂无";66             }67             if (tel == "" || tel == "undefined" || tel == null || tel == " undefined" || typeof address == "tel") {68                 tel = "暂无";69             }70             var str = "  地址:" + address + "<br />  电话:" + tel + " <br />  类型:" + type;71             return str;72         }73         function openMarkerTipById1(pointid, thiss) {  //根据id 打开搜索结果点tip74             thiss.style.background = '#CAE1FF';75             windowsArr[pointid].open(mapObj, marker[pointid]);76 77             //result中每个div触发的事件78             document.getElementById("lngX").value = marker[pointid].getLng();79             document.getElementById("latY").value = marker[pointid].getLat();80 81         }82         function onmouseout_MarkerStyle(pointid, thiss) { //鼠标移开后点样式恢复83             thiss.style.background = "";84         }85         //鼠标在地图上点击,获取经纬度坐标86         function getLnglat(e) {87             document.getElementById("lngX").value = e.lnglat.getLng();88             document.getElementById("latY").value = e.lnglat.getLat();89         }90 91         //关闭页面92         function CloseWind() {93             var lat = document.getElementById("lngX").value;94             var lon = document.getElementById("latY").value;95             opener.setValue(lat + "," + lon);96             window.close();97 98         }
登入後複製

HTML

 1 <script type="text/javascript"></script> 2     <table width="100%" border="0" cellspacing="0" cellpadding="0"> 3         <tr> 4             <td colspan="2"    style="max-width:90%"> 5                 <br> 6                 高德地图:<input type="text" name="searchText"> 7                 <input type="button" value="查询" onclick="placeSearch()" /> 输入位置信息 8                 <br><br>地图经纬度坐标: X:<input type="text" id="lngX" name="lngX" /> Y:<input type="text" id="latY" name="latY" /> 9                 <input type="button" name="btn_Close" id="btn_Close" value="确定,并关闭页面" onclick="CloseWind();" /> *选择正确地点之后,请点击该按钮10             </td>11         </tr>12         <tr>13             <td width="70%" height="500"> <div style="height:100%" id="iCenter"></div></td>14             <td valign="top">15                 <div class="demo_box">16                     <div id="r_title"><b>关键字查询结果:</b></div>17                     <div id="result"> </div>18                 </div>19                 <span class="STYLE1"></span>20             </td>21         </tr>22     </table>
登入後複製

 

程序员淘宝店:http://iduds.taobao.com

本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

如何在iPhone中使Google地圖成為預設地圖 如何在iPhone中使Google地圖成為預設地圖 Apr 17, 2024 pm 07:34 PM

iPhone上的預設地圖是Apple專有的地理位置供應商「地圖」。儘管地圖越來越好,但它在美國以外的地區運作不佳。與谷歌地圖相比,它沒有什麼可提供的。在本文中,我們討論了使用Google地圖成為iPhone上的預設地圖的可行性步驟。如何在iPhone中使Google地圖成為預設地圖將Google地圖設定為手機上的預設地圖應用程式比您想像的要容易。請依照以下步驟操作–先決條件步驟–您必須在手機上安裝Gmail。步驟1–開啟AppStore。步驟2–搜尋“Gmail”。步驟3–點選Gmail應用程式旁

解釋一下explorer.exe進程是什麼 解釋一下explorer.exe進程是什麼 Feb 18, 2024 pm 12:11 PM

explorer.exe是什麼進程在我們使用Windows作業系統的時候,常常會聽到一個名詞"explorer.exe".那麼,你是否好奇這個進程到底是什麼?在本文中,我們將詳細解釋explorer.exe是什麼進程以及其功能和作用。首先,explorer.exe是Windows作業系統的關鍵流程,它負責管理和控制Windows資源管理器(Window

小米 14 Ultra怎麼調整光圈? 小米 14 Ultra怎麼調整光圈? Mar 19, 2024 am 09:01 AM

光圈大小的調整對於拍照效果有著至關重要的影響,小米14Ultra在相機光圈調整方面提供了前所未有的靈活性。為了讓大家都能順利調節光圈,實現光圈大小的自由調節,小編在這裡為大家帶來了小米14Ultra怎麼設定光圈的詳細教學。小米14Ultra怎麼調整光圈?啟動相機,切換至“專業模式”,選擇主鏡頭-W鏡頭。點選光圈,開啟光圈轉盤,A為自動,按需選擇f/1.9或f/4.0。

r5 5600x最高能帶動什麼顯示卡 最新用5600X搭配RX6800XT效能 r5 5600x最高能帶動什麼顯示卡 最新用5600X搭配RX6800XT效能 Feb 25, 2024 am 10:34 AM

10月29日,AMD終於發表了備受用戶期待的重磅產品,即基於全新RDNA2架構的RX6000系列遊戲顯示卡。這款顯示卡與先前推出的基於全新ZEN3架構的銳龍5000系列處理器相輔相成,形成了一個全新的雙A組合。這次的發布不僅使得競爭對手「雙英」黯然失色,也對整個DIY硬體圈產生了重大影響。接下來,圍繞筆者手中這套AMD銳龍5600X和RX6800XT的組合作為測試例子,來見證下現如今的AMD究竟有多麼Yse?首先說說CPU處理器部分,上一代採用ZEN2架構的AMD銳龍3000系列處理器其實已經令用

發生0x0000004e錯誤代表了什麼問題 發生0x0000004e錯誤代表了什麼問題 Feb 18, 2024 pm 01:54 PM

0x0000004e是什麼故障在電腦系統中,故障是常見的問題。當電腦遇到故障時,系統通常會因為無法正常運作而出現停機、當機或出現錯誤提示。而在Windows系統中,有一個特定的故障碼0x0000004e,這是一個藍屏錯誤代碼,表示系統遇到了一個嚴重的錯誤。 0x0000004e藍色畫面錯誤是由於系統核心或驅動程式問題導致的。這種錯誤通常會導致電腦系統

Cheat Engine怎麼設定中文?ce修改器設定中文的方法 Cheat Engine怎麼設定中文?ce修改器設定中文的方法 Mar 18, 2024 pm 01:20 PM

Ce修改器(CheatEngine)是一款專用於對遊戲內存進行修改和編輯的遊戲修改工具,那麼在CheatEngine中怎麼設置中文呢?接下來小編為大夥講述ce修改器設置中文的方法內容,希望可以幫助到有需要的朋友。在我們下載的新軟體中,若發現它不是中文介面,可能會讓人感到困惑。儘管這款軟體不是由中國開發的,但我們仍有方法將其轉換為中文版本。只要簡單地套用中文補丁,就能解決這個問題。在下載並安裝了CheatEngine(ce修改器)軟體後,開啟安裝位置,找到名為languages的資料夾,如下圖所示

記憶體頻率和時序哪個對效能影響較大 記憶體頻率和時序哪個對效能影響較大 Feb 19, 2024 am 08:58 AM

記憶體是電腦中非常重要的組件之一,它對電腦的效能和穩定性有著重要影響。在選擇記憶體時,人們往往會專注於兩個重要的參數,即時序和頻率。那麼,對於記憶體效能來說,時序和頻率哪個更重要呢?首先,我們來了解時序和頻率的概念。時序指的是記憶體晶片在接收和處理資料時所需的時間間隔。它通常以CL值(CASLatency)來表示,CL值越小,記憶體的處理速度越快。而頻率則是內

榮耀 90 GT怎麼更新榮耀MagicOS 8.0? 榮耀 90 GT怎麼更新榮耀MagicOS 8.0? Mar 18, 2024 pm 06:46 PM

榮耀90GT是一款性價比很高的智慧型手機,擁有出色的效能和出色的使用者體驗。然而,有時候我們可能會遇到一些問題,例如榮耀90GT怎麼更新榮耀MagicOS8.0呢?這個步驟因為不同的手機不同的機型可能會有些差別,那麼,讓我們一起來探討一下,如何正確地升級系統。榮耀90GT怎麼更新榮耀MagicOS8.0?2月28日訊息,榮耀今天為旗下90GT/100/100Pro三款手機推送MagicOS8.0公測更新,包版本號為8.0.0.106(C00E106R3P1)1.確保您的榮耀90GT的電池電量充足,

See all articles