有多個獨立的外層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>