在html文件中有如下代码:
<div id="Layer35" onMouseOver="this.style.cursor='pointer'" onClick="chDisp()">some word goes here.</div>刚刚结束的tag没有写对我页面中的是正确的

解决方案 »

  1.   

    <div id="Layer35" onMouseOver="this.style.cursor='pointer'" style="z-index:11" onClick="chDisp()">
      some word goes here.</div> <script language="javascript">
    function chDisp() {
            alert(document.getElementById("Layer35").style.zIndex);
    } </script>
    //可以的,你的css里面定义z-index正确吗?
      

  2.   

    <div id="Layer35" onMouseOver="this.style.cursor='pointer'" style="z-index:11" onClick="chDisp()">
      some word goes here.</div> <script language="javascript">
    function chDisp() {
            alert(document.getElementById("Layer35").style.zIndex);
    } </script>
    这个代码没有问题的呀。不知道楼主的问题咋了
      

  3.   

    css是这样的:
    #Layer35 {
            position:absolute;
            left:297px;
            top:1258px;
            width:116px;
            height:108px;
            z-index:34;
    }
    没有错啊另外我在for循环中用document.getElementById("Layer" + i).style.zIndex
    错误: document.getElementById("Layer" + i) has no properties
    源文件:http://www.vmud.net/www/templates/js/js.js
    行:22
      

  4.   

    多定义一个样式,直接修改className
      

  5.   

    回楼上
    这种方法不可能的
    因为我的div用的是绝对定位
    页面div错落排放
    ……
    不过仍然很感谢大家
    偶继续去试
    实在没人能看出什么就结帖