SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard
    Join Date
    Dec 2004
    Location
    USA
    Posts
    1,407
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    DHTML menu not working

    Here's the javascript snippet:

    HTML Code:
    <style type="TEXT/CSS">
    #menu1{visibility:hidden;}
    ...
    </style>
    <script language=javascript>
    function showmenu(elmnt){
    	document.getElementById(elmnt).style.visibility="visible";
    }
    function hidemenu(elmnt){
    	document.getElementById(elmnt).style.visibility="hidden";
    }
    </script>
    And here's the place that should hide/display:
    HTML Code:
    ...
    <tr><td><a href="#" onClick="return showmenu('menu1')" >Start</a></td></tr>
    <div id="menu1">
      <tr><td class="class1984"><a href="/html/default.asp">HTML</a></td></tr>
    ...
    </div>
    ...
    It is part of a menu that when you click on START, it should display the hidden table records <tr>

    What is happening is the div tag is being stripped out so it's not displaying at all.

    Any ideas why it is NOT displaying when clicked on?

    (forum monitor - Please move this to the most appropriate forum if this is not it)

  2. #2
    Guru in training bronze trophy SoulScratch's Avatar
    Join Date
    Apr 2006
    Location
    Maryland
    Posts
    1,838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ugh, the problem is you need to use valid syntax. You can't have divisions as direct children of a table element. Put the division inside the table cell at least. This is totally not semantic markup, but that should fix it (hopefully) and don't even know why you're returning a function instead of just calling it straightforward.

  3. #3
    SitePoint Wizard
    Join Date
    Dec 2004
    Location
    USA
    Posts
    1,407
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    putting inside tags did hide the text but not the row, even closing the div tag in another row.

    I think I am reworking this in css using visible/hidden

    post closed


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •