我的页面上有以下内容:
<div id="bnr1" align="left">
<a href="ad/index.html" target="_blank">バナー広告募集中!詳しくはこちらから</a>
</div>想写一个函数,在某个事件onClick的时候不显示以上div,写了以下函数,不起作用。
function setDivDisable(){
document.getElementById("bnr1").disable = true;
}请问:这个函数应该怎么写?

解决方案 »

  1.   

    document.getElementById("bnr1").display= "none";
      

  2.   

    document.getElementById("bnr1").display= "none";这个我试了,不行。
      

  3.   

    document.getElementById("bnr1").style.display= "none";
      

  4.   

    disable是禁止,主要对input、select
    3楼的是正确的。
      

  5.   

    document.getElementById("bnr1").style.display= "none"; 
    这个我也试了,不行。
      

  6.   

    <html><head></head><body>
    <div id="bnr1" align="left">
    <a href="ad/index.html" target="_blank">バナー広告募集中!詳しくはこちらから</a></div>
    <input type='button' onclick='setDivDisable()' value='click me' />
    <script type="text/javascript">
    function setDivDisable(){
       document.getElementById("bnr1").style.display="none";
    }
    </script>
    </body></html> 
      

  7.   

    不好意思。
    我搞错了。
    document.getElementById("bnr1").style.display="none";
    这种方法是可以的,谢谢大家!