Baidu Map Bus Query function

Source: Internet
Author: User

<! DOCTYPE html>"Content-type"Content="text/html; Charset=utf-8"/> <script type="Text/javascript"Src="http://api.map.baidu.com/api?v=1.4"></script> <script type="Text/javascript"Src="Http://api.map.baidu.com/library/TextIconOverlay/1.2/src/TextIconOverlay_min.js"></script> <script type="Text/javascript"Src="Http://api.map.baidu.com/library/MarkerClusterer/1.2/src/MarkerClusterer_min.js"></script> <title> A.1 Bus Enquiry function </title>class="wrapper"> <divclass="Header"> Bus Enquiryclass="F-r"> .- on- -</span> Task Description:</p> <p>first, the surrounding query, such as "Primary school";<br/>then, click on any red callout;<br/>Pop-up Information window, enter the need to go to the address, such as "posts and telecommunications", click "Go", can appear bus ride route. </p> </div> <divclass="Container Clearfix"> <divclass="Clearfix"> <input id="Txtsearch"Type="text"Value="Primary School"/><input type="Button"Value="Enquiry"onclick="Search ()"/></div> <div style="Clear:both;"> <div style="Float:left, width:500px, height:340px, border:1px solid gray"Id="Container"> </div> <div id="Divresult"style="Float:left, width:500px, height:340px, background: #eee"> </div> </div> </div> </div></body>"Text/javascript">varMap =NewBmap.map ("Container"); Map.centerandzoom (NewBmap.point (116.330599,39.95536), -); varCurtitle =""; varTS =NewBmap.transitroute (map, {renderoptions: {map:map, Autoviewport:true, Panel:"Divresult"        }    }); function Search () {vars = document.getElementById ("Txtsearch"); varls =NewBmap.localsearch (map, {pagecapacity: -});//Local Search, providing location search services in a specific region, such as searching for "Parks" in Beijing. Ls.setsearchcompletecallback (function (result) {//Call Method when search is completemap.clearoverlays (); if(Ls.getstatus () = =bmap_status_success) {                varCurnum =Result.getcurrentnumpois ();  for(vari =0; i < Curnum; i++) {                    varPOI =Result.getpoi (i); varLNG =poi.point.lng; varLat =Poi.point.lat; vartitle =Poi.title; varPT =NewBmap.point (LNG, LAT); varMarker =NewBmap.marker (PT);//CalloutMarker.settitle (title); Marker.addeventlistener ("Click", Fnclick (marker));//Labeling Listener EventsMap.addoverlay (marker);        }            }        }); Ls.searchinbounds (S.value, Map.getbounds ()); //Range Search will provide search results based on the field of vision you provide} function Fnclick (marker) {returnfunction () {Curtitle=Marker.gettitle (); varHTML ="from"+ Curtitle +"departure, sit <b> bus </b> to"+"<input id= ' txtdest ' type= ' text ' value= ' posts and telecommunications '/><input type= ' button ' value= ' query ' onclick= ' tsearch () '/ >"; varInfowin =NewBmap.infowindow (HTML);//Display InformationInfowin.addeventlistener ("Open", function () {document.getElementById ("txtdest"). focus ();            });        Marker.openinfowindow (Infowin); }} function Tsearch () {if(Curtitle.length >0) {            varDest = document.getElementById ("txtdest"). Value;        Ts.search (Curtitle, dest); }    }   </script>

Baidu Map Bus Query function

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.