onmouseover不触发,望指教

问题描述:

a标签似乎是被覆盖了,但是找不到问题根源。z-index属性修改没有效果

CSS

 .demo{  width:1000px; height:442px; overflow:hidden;margin:0px;z-index:-1; padding:0px; position:relative; }
.num { bottom: 10px; right: 50px; width:auto;height:8px;z-index:10; position:absolute;}
.num a{cursor:pointer;  width:8px; height:8px; background:url(../images/bicon_bg.png) no-repeat bottom; margin-right:4px; float:left;display:inline-block; border:1px solid red;position:relative;z-index:50;}
.num a:hover {cursor:pointer; background:#ff7d01; width:8px; height:8px; display:block; color:#fff; }
.demo ul {position:relative;z-index:5;width:956px; }
.demo ul li {position:absolute; display:none; margin:0px;padding:0px;width:1000px; }
.demo ul li .demo-img{ width:1000px;height:442px;float:left; display:inline; }
.demo ul li .demo-img img{ width:1000px; height:442px;}
.demo .num a.cur{ background:url(../images/bicon_bg.png) no-repeat top; display:block;}

前端是这样的结构

 <div class="demo">
                            <div class="num">
                                                                        <a href="#" class='cur'></a>
                                                                        <a href="#" ></a>
                                                                        <a href="#" ></a>                                                                       
                                                        </div>
                            <ul>
                                <li style='DISPLAY: block' ><img src='imagestext/20140916064258.jpg'  width="1000" height="442"></li> 
                                 <li  ><img src='imagestext/20130531030129.jpg'  width="1000" height="442"></li> 
                                  <li  ><img src='imagestext/20140905105755.jpg'  width="1000" height="442"></li>                                  
                            </ul>
                        </div>

.demo你设置z-index为-1不就到body后面了。。当然获取不到焦点了,去掉z-index:-1

     .demo {
        width: 1000px;
        height: 442px;
        overflow: hidden;
        margin: 0px;
       /* z-index: -1;*/
        padding: 0px;
        position: relative;
    }

用document.getElementById('id').onmouseover = function () { }试下

ie6、7不支持 a:hover ,如果要实现此功能,需要添onmouseover事件响应

是你Javascript代码写的有点问题吧,你仔细找找,我的挺好的,或许onmouseover和hover有点冲突。

覆盖问题用 z-index解决,不起作用的话,你把这个事件用行内式写一写试一试

问题解决了,感谢各位老师不吝赐教