Native JavaScript is more convenient for DOM operations than jquery, especially when no ID or class is available, only with tag name.
HTML DOM Element Object Operation http://www.w3school.com.cn/jsref/dom_obj_all.asp
Baidu Open Platform: http://lbsyun.baidu.com/index.php?title=open/library&qq-pf-to=pcqq.group
#container{Font-size:12px; Margin: 5px 0; }</style><title>City List Display Example</title><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/CityList/1.4/src/CityList_min.js" ></ Script>//New Map CreationvarMap =NewBmap.map ("Map_container"); Map. Centerandzoom (NewBmap.point (121.478125,31.229649), 12);varCityList =NewBmaplib.citylist ({container: ' Container ',Map:map}); CityList. getbusiness (' Zhongguancun ',function(JSON) {Console.Log(' Business Circle '); Console.Log(JSON);}); CityList. getsubarealist (131,function(JSON) {Console.Log(' City list '); Console.Log(JSON); }); CityList. AddEventListener (' Cityclick ',function(e) {Console.Log(e);});functiondisplaydate () {varAreaindex = 16; varb = document.getElementsByTagName (' select ') [2].Childnodes[areaindex]; varc = document.getElementsByTagName (' select ') [3].ChildNodes; varTXT = "; for(I=1; i<c.length; i++) { if(i<c.length-1) {txt+ = ' (\ ' +c[i].value + ' \ ' + ', ' + ' \ ' +c[i].text+ ' \ ' + ', ' + ' \ ' +b.value+ ' \ ' + '), ' + ' <br> '; }Else{txt+ = ' (\ ' +c[i].value + ' \ ' + ', ' + ' \ ' +c[i].text+ ' \ ' + ', ' + ' \ ' +b.value+ ' \ ' + ') ' + ' <br> '; } }; varX=document.getelementbyid ("Demo"); X. innerhtml=txt;}</script>
<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/CityList/1.4/src/CityList_min.js "></script>
<button type= "button" onclick= "Displaydate ()" >show</button>
<div id= "Demo" ></div></body>var citylist = new Bmaplib.citylist ({container: ' container ', map:map});
Citylist.getbusiness (' Zhongguancun ', function (JSON) {console.log (' Business Circle '); Console.log (JSON);});
Citylist.getsubarealist (131, function (JSON) {console.log (' city list '); Console.log (JSON); });
Citylist.addeventlistener (' Cityclick ', function (e) {console.log (e);});
function Displaydate () {
var areaindex = 16;
var B = document.getelementsbytagname (' select ') [2].childnodes[areaindex];
var c = document.getelementsbytagname (' select ') [3].childnodes;
var txt = ';
for (I=1; i<c.length; i++) {if (i<c.length-1) {txt + = ' (\ ' +c[i].value + ' \ ' + '), ' + ' \ ' +c[i].tex t+ ' + ' + ', ' + ' \ ' +b.value+ ' \ ' + '), ' + ' <br> '; }else{
TXT + = ' (\ ' +c[i].value + ' \ ' + ', ' + ' \ ' +c[i].text+ ' \ ' + ', ' + ' \ ' +b.value+ ' \ ' + ') ' + ' <br> '; } }; var X=document.getelementbyid ("demo"); X.innerhtml=txt;
}
</script>
JavaScript's access to Baidu address parameter method