今天早上在写代码的时候,需要用到地图坐标拾取工具,我们用的是搞的地图,在高德地图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/imghwm/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" height="50"> 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

부울 속성은 값없이 활성화되는 HTML의 특수 속성입니다. 1. 부울 속성은 입력 상자를 비활성화하는 등의 존재 여부에 따라 요소의 동작을 제어합니다. 2. 작업 원칙은 브라우저가 구문 분석 할 때 속성의 존재에 따라 요소 동작을 변경하는 것입니다. 3. 기본 사용법은 속성을 직접 추가하는 것이며, 고급 사용량은 JavaScript를 통해 동적으로 제어 될 수 있습니다. 4. 일반적인 실수는 값을 설정해야한다고 잘못 생각하고 올바른 글쓰기 방법은 간결해야합니다. 5. 모범 사례는 코드를 간결하게 유지하고 부울 속성을 합리적으로 사용하여 웹 페이지 성능 및 사용자 경험을 최적화하는 것입니다.

HTML 코드는 온라인 유효성 검사기, 통합 도구 및 자동화 된 프로세스를 통해 깨끗할 수 있습니다. 1) w3cmarkupvalidationservice를 사용하여 온라인으로 HTML 코드를 확인하십시오. 2) 실시간 확인을 위해 VisualStudioCode에 HTMLHINT 확장을 설치하고 구성하십시오. 3) htmltidy를 사용하여 시공 프로세스에서 HTML 파일을 자동으로 확인하고 청소하십시오.

HTML, CSS 및 JavaScript는 최신 웹 페이지를 구축하기위한 핵심 기술입니다. 1. HTML 웹 페이지 구조를 정의합니다. 2. CSS는 웹 페이지의 모양을 담당합니다.

HTML의 기능은 웹 페이지의 구조와 내용을 정의하는 것이며, 그 목적은 정보를 표시하는 표준화 된 방법을 제공하는 것입니다. 1) HTML은 타이틀 및 단락과 같은 태그 및 속성을 통해 웹 페이지의 다양한 부분을 구성합니다. 2) 콘텐츠 및 성능 분리를 지원하고 유지 보수 효율성을 향상시킵니다. 3) HTML은 확장 가능하므로 사용자 정의 태그가 SEO를 향상시킬 수 있습니다.

HTML의 미래 트렌드는 의미론 및 웹 구성 요소이며 CSS의 미래 트렌드는 CSS-In-JS 및 CSShoudini이며, JavaScript의 미래 트렌드는 WebAssembly 및 서버리스입니다. 1. HTML 시맨틱은 접근성과 SEO 효과를 향상시키고 웹 구성 요소는 개발 효율성을 향상 시키지만 브라우저 호환성에주의를 기울여야합니다. 2. CSS-in-JS는 스타일 관리 유연성을 향상 시키지만 파일 크기를 증가시킬 수 있습니다. CSShoudini는 CSS 렌더링의 직접 작동을 허용합니다. 3. Webosembly는 브라우저 애플리케이션 성능을 최적화하지만 가파른 학습 곡선을 가지고 있으며 서버리스는 개발을 단순화하지만 콜드 스타트 문제의 최적화가 필요합니다.

웹 개발에서 HTML, CSS 및 JavaScript의 역할은 다음과 같습니다. 1. HTML은 웹 페이지 구조를 정의하고, 2. CSS는 웹 페이지 스타일을 제어하고 3. JavaScript는 동적 동작을 추가합니다. 그들은 함께 현대 웹 사이트의 프레임 워크, 미학 및 상호 작용을 구축합니다.

HTML의 미래는 무한한 가능성으로 가득합니다. 1) 새로운 기능과 표준에는 더 많은 의미 론적 태그와 WebComponents의 인기가 포함됩니다. 2) 웹 디자인 트렌드는 반응적이고 접근 가능한 디자인을 향해 계속 발전 할 것입니다. 3) 성능 최적화는 반응 형 이미지 로딩 및 게으른로드 기술을 통해 사용자 경험을 향상시킬 것입니다.

웹 개발에서 HTML, CSS 및 JavaScript의 역할은 다음과 같습니다. HTML은 컨텐츠 구조를 담당하고 CSS는 스타일을 담당하며 JavaScript는 동적 동작을 담당합니다. 1. HTML은 태그를 통해 웹 페이지 구조와 컨텐츠를 정의하여 의미를 보장합니다. 2. CSS는 선택기와 속성을 통해 웹 페이지 스타일을 제어하여 아름답고 읽기 쉽게 만듭니다. 3. JavaScript는 스크립트를 통해 웹 페이지 동작을 제어하여 동적 및 대화식 기능을 달성합니다.


핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

Video Face Swap
완전히 무료인 AI 얼굴 교환 도구를 사용하여 모든 비디오의 얼굴을 쉽게 바꾸세요!

인기 기사

뜨거운 도구

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

Eclipse용 SAP NetWeaver 서버 어댑터
Eclipse를 SAP NetWeaver 애플리케이션 서버와 통합합니다.

WebStorm Mac 버전
유용한 JavaScript 개발 도구

SublimeText3 Linux 새 버전
SublimeText3 Linux 최신 버전

MinGW - Windows용 미니멀리스트 GNU
이 프로젝트는 osdn.net/projects/mingw로 마이그레이션되는 중입니다. 계속해서 그곳에서 우리를 팔로우할 수 있습니다. MinGW: GCC(GNU Compiler Collection)의 기본 Windows 포트로, 기본 Windows 애플리케이션을 구축하기 위한 무료 배포 가능 가져오기 라이브러리 및 헤더 파일로 C99 기능을 지원하는 MSVC 런타임에 대한 확장이 포함되어 있습니다. 모든 MinGW 소프트웨어는 64비트 Windows 플랫폼에서 실행될 수 있습니다.
