<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
*{
padding:0;
margin:0;
}
ul,li{
list-style: none;
}
li{
display: inline-block;
border:solid 1px pink;
background-color: pink;
width:80px;
height:26px;
line-height: 26px;
text-align: center;
cursor: pointer;
}
div{
width:300px;
height:150px;
background-color: skyblue;
border:solid 1px skyblue;
display: none;
}
div.content{
display: block;
}
li.table{
background-color: skyblue;
border: solid 1px skyblue;
}
</style>
</head>
<body>
<ul>
<li class="table">犬夜叉</li>
<li>桔梗</li>
<li>奈落</li>
</ul>
<div class="content">犬夜叉模块</div>
<div>桔梗模块</div>
<div>奈落模块</div>
<script>
var lis = document.getElementsByTagName('li');
var divs = document.getElementsByTagName('div');
for(var i=0; i<lis.length; i++){
lis[i].index=i;
lis[i].onclick=function(){
for(var f=0; f<lis.length; f++){
if(f == this.index){
lis[f].className='table';
divs[f].className='content';
}else{
lis[f].className='';
divs[f].className='';
}
}
}
}
</script>
</body>
</html>