webveuje/teaching/wanzhaoyi/suning.html
2021-06-03 10:52:41 +08:00

239 lines
7.0 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
*{
margin: 0;
padding:0
}
.nav{
background: #f5f5f5;
height: 35px;
}
.daohang{
width: 1190px;
margin:0 auto;
}
.nav-item{
float: left;
width:85px;
/* height:35px; */
list-style: none;
text-align: center;
cursor:pointer;
line-height: 35px;
color:#666;
font-size: 12px;
/* background: gold; */
}
.nav-item:hover{
background-color: white;
}
.right li{
float:right
}
.nav_bottom{
width:93%;
margin:0 auto;
border: 1px solid #666;
overflow: auto;
display: none;
/* visibility: hidden; //可见还是不可见 */
}
.nav_b_1l{
float: left;
padding-left: 20px;
}
.nav_b_1r{
margin-top: 21px;
float: left;
margin-left:30px;
}
.title{
font-weight: bold;
}
.nav_b_1 dd{
margin-top: 5px;
}
.nav_b_1{
padding-right: 30px;
border-right: 1px solid red;
overflow: auto;
float: left;
font-size: 12px;
}
</style>
<style>
.tab{
width: 450px;
overflow: auto;
/* padding-bottom: 10px; */
border-bottom: 1px solid #666;
}
.tab-item{
float: left;
margin-left: 40px;
cursor: pointer;
padding-bottom: 10px;
border-bottom: 2px solid #666;
}
.selected{
border-bottom: 2px solid red;
}
</style>
<script>
function enter(){
// console.log("enter")
var frame=document.getElementsByClassName("nav_bottom");
console.log(frame)
frame[0].setAttribute("style","display:block")
}
function out(){
// console.log("enter")
var frame=document.getElementsByClassName("nav_bottom");
console.log(frame)
frame[0].setAttribute("style","display:none")
}
function xz(e){
console.log(e)
var tablist=document.getElementsByClassName("tab-item")
for(var i=0;i<tablist.length;i++){
console.log(tablist[i],11)
tablist[i].setAttribute("class","tab-item")
}
tablist[e].setAttribute("class","tab-item selected")
// setAttribute(属性名,属性值) 给选中元素加属性
// 不能用for in 循环 他会把对象多余的属性或者方法都取出来
}
</script>
</head>
<body>
<div class="nav">
<div class="daohang">
<ul class="left">
<li class="nav-item" onmouseover="enter()" onmouseout="out()">网站导航</li>
<li class="nav-item">网站导航</li>
<li class="nav-item">网站导航</li>
</ul>
<ul class="right">
<li class="nav-item ">网站导航6</li>
<li class="nav-item">网站导航5</li>
<li class="nav-item">网站导航4</li>
<li class="nav-item">网站导航3</li>
<li class="nav-item">网站导航2</li>
<li class="nav-item">网站导航1</li>
</ul>
</div>
</div>
<div class="nav_bottom">
<div class="nav_b_1">
<dl class="nav_b_1l">
<dt class="title">特色购物</dt>
<dd>电视机</dd>
<dd>冰箱22222222</dd>
<dd>冰箱22222222</dd>
<dd>冰箱22222222</dd>
<dd>冰箱22222222</dd>
</dl>
<dl class="nav_b_1r">
<dd>冰箱22222222</dd>
<dd>冰箱22222222</dd>
<dd>冰箱22222222</dd>
<dd>冰箱22222222</dd>
</dl>
</div>
<div class="nav_b_1">
<dl class="nav_b_1l">
<dt class="title">特色购物</dt>
<dd>电视机</dd>
<dd>冰箱22222222</dd>
<dd>冰箱22222222</dd>
<dd>冰箱22222222</dd>
<dd>冰箱22222222</dd>
</dl>
<dl class="nav_b_1r">
<dd>冰箱22222222</dd>
<dd>冰箱22222222</dd>
<dd>冰箱22222222</dd>
<dd>冰箱22222222</dd>
</dl>
</div>
<div class="nav_b_1">
<dl class="nav_b_1l">
<dt class="title">特色购物</dt>
<dd>电视机</dd>
<dd>冰箱22222222</dd>
<dd>冰箱22222222</dd>
<dd>冰箱22222222</dd>
<dd>冰箱22222222</dd>
</dl>
<dl class="nav_b_1r">
<dd>冰箱22222222</dd>
<dd>冰箱22222222</dd>
<dd>冰箱22222222</dd>
<dd>冰箱22222222</dd>
</dl>
</div>
<div class="nav_b_1">
<dl class="nav_b_1l">
<dt class="title">特色购物</dt>
<dd>电视机</dd>
<dd>冰箱22222222</dd>
<dd>冰箱22222222</dd>
<dd>冰箱22222222</dd>
<dd>冰箱22222222</dd>
</dl>
<dl class="nav_b_1r">
<dd>冰箱22222222</dd>
<dd>冰箱22222222</dd>
<dd>冰箱22222222</dd>
<dd>冰箱22222222</dd>
</dl>
</div>
<div class="nav_b_1">
<dl class="nav_b_1l">
<dt class="title">特色购物</dt>
<dd>电视机</dd>
<dd>冰箱22222222</dd>
<dd>冰箱22222222</dd>
<dd>冰箱22222222</dd>
<dd>冰箱22222222</dd>
</dl>
<dl class="nav_b_1r">
<dd>冰箱22222222</dd>
<dd>冰箱22222222</dd>
<dd>冰箱22222222</dd>
<dd>冰箱22222222</dd>
</dl>
</div>
</div>
<div class="tab">
<p class="tab-item selected" onclick="xz(0)">全部</p>
<p class="tab-item" onclick="xz(1)">待付款</p>
<p class="tab-item" onclick="xz(2)">待发货</p>
<p class="tab-item" onclick="xz(3)">待收货</p>
<p class="tab-item" onclick="xz(4)">待评价</p>
</div>
</body>
</html>