首页 > 代码库 > dom 筛选器
dom 筛选器
<!doctype html><html><head><meta charset="utf-8"><title>无标题文档</title><style>dd { cursor: pointer; }</style><script type="text/javascript">window.onload = function (){ var odl = document.getElementsByTagName(‘dl‘); var odiv = document.getElementById(‘div1‘); var location = ‘‘; var position = ‘‘; var salary = ‘‘; for(var i = 0; i < odl.length; i++) { fn(i); } function fn(n) { var odd = odl[n].getElementsByTagName(‘dd‘); for(var i = 0; i < odd.length; i++ ) { odd[i].onclick = function () { switch(n) { case 0: location = this.innerHTML + ‘ ‘; break; case 1: position = this.innerHTML + ‘ ‘; break; case 2: salary = this.innerHTML + ‘ ‘; break; } odiv.innerHTML = location + position + salary; }; } }}</script></head><body> <dl> <dt>地区</dt> <dd>东城</dd> <dd>西城</dd> <dd>朝阳</dd> <dd>昌平</dd> </dl> <dl> <dt>职位</dt> <dd>美工设计</dd> <dd>前端工程师</dd> <dd>后台开发</dd> </dl> <dl> <dt>薪资</dt> <dd>4000</dd> <dd>5000</dd> <dd>6000</dd> </dl> <div id="div1"></div></body></html>
dom 筛选器
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。