javascript show/hide with memory

Posted by gloris on Stack Overflow See other posts from Stack Overflow or by gloris
Published on 2010-06-18T05:45:04Z Indexed on 2010/06/18 5:53 UTC
Read the original article Hit count: 177

Filed under:

Hi,

i have this show/hide menu. It is possibly this menu make with memory?( I open sub menu, refresh page and this sub menu stil open. )

<script type="text/javascript">
function change(id){
     ID = document.getElementById(id);

     if(ID.style.display == "")
          ID.style.display = "none";
     else
          ID.style.display = "";
      }
</script>
    <div onclick="change(5)" style="cursor: hand">
        <a href = "#">+</a>News
    </div>
    <div style="display: none" id="5">
        News1<br/>
        News2<br/>
    </div>

© Stack Overflow or respective owner

Related posts about JavaScript