有多个独立的外层div,每个外层div内嵌一个内层的div,内层div在显示在外层div的下部。我要的效果是,当鼠标移入到一个外层div中时,改变这个外层div内的那个内层div。用Js怎么写代码?求大神指导
<!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>
<script>
function MM_over(mmObj) {
var mSubObj = mmObj.getElementsByTagName("div")[0];
mSubObj.style.display = "block";
mSubObj.style.backgroundColor = "#f60";
}
function MM_out(mmObj) {
var mSubObj = mmObj.getElementsByTagName("div")[0];
mSubObj.style.display = "none";
}
</script>
</head>
<body>
<div onmouseover="MM_over(this)" onmouseout="MM_out(this)" style="width:100px;position:relative;">sdfsdf
<div style="width:100px;height:100px;display:none;position:absolute;left:0;top:15px;z-inde:5;"><p><a href="#">ssss</a></p><p><a href="#">ssss</a></p>
</div>
</div>
</body>
</html>
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。