61,112
社区成员
发帖
与我相关
我的任务
分享
<style type="text/css">
.mian{width:500px;height:800px;background:#555;margin:0 auto;}
.box{width:500px;height:800px;position:relative;}
.box ul{margin:0px;padding:0;list-style:none;}
.box h4{margin:0px;width:150px;height:50px;background:#999;line-height:50px;cursor:pointer;position:relative;}
.box ul li{display:none;background:red;width:250px;height:350px;position:absolute;left:150px;top:0px;margin:0px;padding:0;}
.box ul:hover li{display:block;}
</style>
<div class="mian">
<div class="box">
<ul><h4>第1段文字</h4><li>隐藏文字一</li></ul>
<ul><h4>第2段文字</h4><li>隐藏文字二</li></ul>
<ul><h4>第3段文字</h4><li>隐藏文字三</li></ul>
<ul><h4>第4段文字</h4><li>隐藏文字四</li></ul>
</div>
</div>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
.mian{width:500px;height:800px;background:#555;margin:0 auto;}
.box{width:500px;height:800px;position:relative;}
.box ul{margin:0px;padding:0;list-style:none;}
.box h4{margin:0px;width:150px;height:50px;background:#999;line-height:50px;cursor:pointer;position:relative;}
.box ul li{display:none;background:red;width:250px;height:350px;position:absolute;left:150px;top:0px;margin:0px;padding:0;}
</style>
<script type="text/javascript">
window.onload=function(){
var oDiv = document.getElementById('box');
var oUl = oDiv.getElementsByTagName('ul');
for(var i = 0; i<oUl.length;i++){
oUl[i].onmouseover=function(){
this.childNodes[1].style.display='block';
}
oUl[i].onmouseout=function(){
this.childNodes[1].style.display='none';
}
}
}
</script>
</head>
<body>
<div class="mian">
<div class="box" id="box">
<ul><h4>第1段文字</h4><li>隐藏文字一</li></ul>
<ul><h4>第2段文字</h4><li>隐藏文字二</li></ul>
<ul><h4>第3段文字</h4><li>隐藏文字三</li></ul>
<ul><h4>第4段文字</h4><li>隐藏文字四</li></ul>
</div>
</div>
</body>
</html>