小斑马在沙巴找BUG 2017-02-13 06:59 采纳率: 0%
浏览 1895
已结题

为什么input放到绝对定位的元素之上,0001和0002上的按钮就没有了点击效果?

 <!DOCTYPE html>
<html lang="en">
<head>
<style type="text/css">
    ul{list-style: none;width: 300px;margin:0 auto;height:30px;padding-left: 0px;}
    li:hover{background-color: #ccc;color:red;}
    .li-current {background-color: #ccc;color:red;}
    li{float:left;border:1px solid #000;width: 98px;text-align: center;height: 28px;}
    .tab-list{width: 298px;height:270px;border:1px solid #000;margin:0 auto;clear:both;position: relative;}
    .tab-list div{width: 298px;height:270px;position: absolute; opacity:0;filter:alpha(opacity=0);}
    .tab-list .current{opacity:1;filter:alpha(opacity=100);}
    .tab-list input{width: 80px;height: 50px;}
</style>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
 <ul id="control-menu">
      <li>001</li>
      <li>002</li>
      <li>003</li>
 </ul> 
  <div class="tab-list" id="tab-list">
    <div class="current">0001
        <input type="button" name="" value="0001">
    </div>
    <div >0002
        <input type="button" name="" value="0002">
    </div>
    <div >0003
        <input type="button" name="" value="0003">
    </div>
  </div>
  <script type="text/javascript">
    window.onload=function(){
        var oUl=document.getElementById('control-menu');
        var aLi=oUl.getElementsByTagName('li');
        var oDiv=document.getElementById('tab-list');
        var options=oDiv.getElementsByTagName('div');
        var i=0;
        for (i;i<aLi.length ; i++) {
        aLi[i].index=i;
         aLi[i].onmouseover=function(){ 
            show(this.index);
         }          
        }

        function show(a){
        for (var j = 0;j<aLi.length ; j++ ) {
            options[j].className="";//清除原有样式
            aLi[j].className="";
        }
        options[a].className="current";
        aLi[a].className="li-current";
        }
    }
  </script>
</body>
</html>
  • 写回答

5条回答 默认 最新

  • Z. ZHANG 2017-02-13 07:06
    关注

    你一说我想起我之前用a标签 好想也不行

    评论

报告相同问题?

悬赏问题

  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 Revit2020下载问题
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大