首页 > 代码库 > 选项卡切换
选项卡切换
1.
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> <style> .red{background: red} #list{list-style: none;} #list li{position: relative; float: left; margin: 50px;} div, .hide{display: none} .show{display: block} </style> </head> <body> <script> window.onload = function(){ var oUl = document.getElementById(‘list‘); var arrLi = oUl.getElementsByTagName(‘li‘); for(var i = 0; i < arrLi.length; i++){ fnTab(arrLi[i], arrLi); } function fnTab(oLi, aLi){ var oA = oLi.getElementsByTagName(‘a‘)[0]; var oDiv = oLi.getElementsByTagName(‘div‘)[0]; oA.onclick = function () { for(var i = 0; i < aLi.length; i++){ aLi[i].getElementsByTagName(‘a‘)[0].className = ‘‘; aLi[i].getElementsByTagName(‘div‘)[0].className = ‘hide‘; } oA.className = ‘red‘; oDiv.className = ‘show‘; } } } </script> <ul id="list"> <li> <a href="javascript:;">简介</a> <div>简介.........</div> </li> <li> <a href="javascript:;">会议</a> <div>会议.........</div> </li> <li> <a href="javascript:;">回看</a> <div>回看.........</div> </li> </ul> </body> </html>
选项卡切换
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。