function dian(obj){
if(obj.style.display=="none")
{obj.style.display=""
}else{
obj.style.display="none"
}
}

解决方案 »

  1.   

    function dian(obj){
    if(obj.style.display=="none")
    {obj.style.display="black"
    }else{
    obj.style.display="none"
    }
      

  2.   

    obj.style.display="black" block?
      

  3.   

    LZ的原代码好像在FF下也正常呀<table id="data">
    <div id="div" style="width:200px;height:200px;background-color:yellow;"></div>
    <input type="button" value="buttn" onclick="dian(document.getElementById('div'))");
    </table><script>
    function dian(obj){
    if(obj.style.display=="none")
    {
    obj.style.display=""
    }
    else{
    obj.style.display="none"
    }

    </script>
      

  4.   

    改成obj.style.display="block"吧!
    其实这样做也不是太好。
    要是需要获取焦点的话减少设置obj的宽度和高度为零来实现显示隐藏。
      

  5.   

    我在ONCLICK上不是这样写的,我写的是ONCLICK=THIS.PARENTNODE.NEXTSLBIING,这样可以吗
      

  6.   

    THIS.PARENTNODE.NEXTSLBIING 用这个还真是不行
      

  7.   

    在FF下,节点间的空格也是节点,这个与IE不一样
    THIS.PARENTNODE.NEXTSLBIING.NEXTSLBIING
    这样就可以
      

  8.   


    <html>
    <div id="div1">
    <input type="button" value="buttn" onclick="dian(this.parentNode.nextSibling)") />
    </div>
    <div id="div" style="width:200px;height:200px;background-color:yellow;"></div></html>
    <script>
    function dian(obj){
    if(obj.nodeType==3)
      obj=obj.nextSibling;
    if(obj.style.display=="none")
    {
    obj.style.display="block"
    }
    else{
    obj.style.display="none"
    }

    </script>