有多个独立的外层div,每个外层div内嵌一个内层的div,内层div在显示在外层div的下部。我要的效果是,当鼠标移入到一个外层div中时,改变这个外层div内的那个内层div。用Js怎么写代码?求大神指导
3条回答 默认 最新
- danielinbiti 2015-09-01 03:22关注
<!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>
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
- ¥15 如何在scanpy上做差异基因和通路富集?
- ¥20 关于#硬件工程#的问题,请各位专家解答!
- ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
- ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
- ¥30 截图中的mathematics程序转换成matlab
- ¥15 动力学代码报错,维度不匹配
- ¥15 Power query添加列问题
- ¥50 Kubernetes&Fission&Eleasticsearch
- ¥15 報錯:Person is not mapped,如何解決?