js代理设置点击位置方法
//top20 var cityUlID = T.G('cityUlID'); T.on(cityUlID,'click',function(event){ var event = event||window.event; var ele = event.srcElement||event.target; //var FathorID = T.dom.getParent(ele); if(ele){ if(ele.className==="ecl-ecl_map_hotel_cityItem") { cityValue1.value = ele.innerHTML; setCityValue2Attr(ele,"data-id",cityValue1); initCityList2(T.getAttr(ele,"data-id"));//初始化 city-2 列表 console.log("1:"+T.getAttr(ele,"data-id")); } if(T.G('cityListID').style.display!="none"){ T.G('cityListID').style.display="none"; } } });
<div class="ecl-ecl_map_hotel_citylist" id="cityListID" style="display:none;"><!--城市浮层--> <span class="ecl-ecl_map_hotel_ecl-ecl_map_hotel_cityTopclose"></span> <div class="ecl-ecl_map_hotel_cityTop">Top 20热门城市(直接输入可搜索22699个城市)</div> <ul id="cityUlID" class="c-clearfix"> </ul> </div>