<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <title></title> <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"/> </head> <body> <div class="container"> <ul class="nav nav-tabs"> <li id="li1" class="active"><a href="#">11111</a></li> <li id="li2"><a href="#">11111</a></li> <li id="li3"><a href="#">11111</a></li> </ul> </div> <script type="text/javascript"> var oLi1 = document.getElementById('li1') var oLi2 = document.getElementById('li2') var oLi3 = document.getElementById('li3') oLi1.onclick = function(){ oLi1.className ='active' oLi2.className ='' oLi3.className ='' } oLi2.onclick = function(){ oLi2.className ='active' oLi1.className ='' oLi3.className ='' } oLi3.onclick = function(){ oLi3.className ='active' oLi2.className ='' oLi1.className ='' } </script> </body></html>
添加回答
举报
0/150
提交
取消