SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    Oct 2002
    Posts
    229
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    javascript:expandIT and tables

    Hello,

    I am using JavaScript:expand it to create an expanding menu. This works fine, but I want to be able to structure it in a table so that it also aligned nicely. However when I try to add an table structure, the expanding menu does not work? Does anyone know if it is possible to use tables and expanding menus together?

    This is the code that works, but as soon as any tags go inbetween the <P id="Listone"> </p> then the expanding part does not work.
    <html>
    <head>
    <script language="JavaScript">
    <!--
    function expandIt(getIt){
    getIt.style.display=(getIt.style.display=="none")?"":"none";
    }
    //-->
    </script>
    </head>
    <body>

    <table border=0 cellspacing=0 cellpadding=0>
    <tr>
    <td><font size="2"><img src=""jointop.gif></td>
    <td><a href="/__80256A010037BAD9.nsf/vWeb/wpGFAX5GPLB9"><img src=""msie_doc.gif border=0></td>
    <td colspan=1</td><td colspan=9><font size="2">AMA Home</a></td>
    </tr>

    <tr>
    <td colspan=1><a href="javascript:expandIt(listOne)"><img src=""plus.gif border=0></a></td>
    <td colspan=9><img src=""folderclosed.gif BORDER=0><FONT SIZE="2">Pages</td></tr>
    <p id="listOne" style="display:none">
    <img src=""line.gif>
    <img src=""msie_doc.gif>
    <a href="page1.html"><font size="2">First Page</a>

    <img src=""msie_doc.gif>
    <a href="page2.html/"><font size="2">Second Page</a><BR>
    </p>

    </table>
    Eternity

  2. #2
    SitePoint Addict BenANFA's Avatar
    Join Date
    Apr 2003
    Location
    Bath, UK
    Posts
    353
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This code does not work for me,

    1) You should not put a <p>...</p> inside a table not inside a cell

    2) All your <img ... > tags have the src strings wrong

    3) None of your <font ... > tags are closed and anyway it would be better to use styles.

    When I move the <p> ... </p> outside the table it works. Which bit did you want to move inside the <p> ... </p>

  3. #3
    SitePoint Wizard silver trophy
    Join Date
    May 2003
    Posts
    1,843
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just a note: it's perfectly OK to put block-level elements - like <p> - inside tables, but you can't put anything (except a <td> or a <th>) directly inside a <tr>. Table rows are just containers for other table components.
    Last edited by adios; May 20, 2003 at 08:50.

  4. #4
    SitePoint Addict BenANFA's Avatar
    Join Date
    Apr 2003
    Location
    Bath, UK
    Posts
    353
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by adios
    Just a note: it's perfectly to put block-level elements - like <p> - inside tables, but you can't put anything (except a <td> or a <th>) directly inside a <tr>. Table rows are just containers for other table components.
    Oops I stand (well sit really ) corrected, however the code supplied did not work as written and that was one of the things I had to do to get its operation to resemble the description.


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
  •