Results 1 to 5 of 5

Thread: Java menu postion in nested tables...problems.

  1. #1
    Member
    Join Date
    Sep 2005
    Location
    Minehead, Somerset.
    Posts
    197
    Thanks
    0
    Thanked
    0 times in 0 posts

    Java menu postion in nested tables...problems.

    If we put our menu in it's own table it works fine. However, if we put it in a cell below another object, or nest it inside another table, the position is incorrect. Well, it works ok in Firefox but not Internet Explorer. It seems as though the offset top isn't being calculated correctly in IE.

    E.g. this works fine:
    Code:
    <BODY>
    <div align="center">
    <table>
       <tr>
         <td>
            --Menu javascript code here-- 
         </td>
       </tr>
    </table> 
    </body>
    As does this:
    Code:
    <body>
    <div align="center">
    <table>
         <tr>
              <td>
                    --Some Picture goes here --- 
             </td>
         </tr>
    </table> 
    <table>
         <tr>
             <td>
             --Menu Code Goes Here--
             </td>
         </tr>
    </table> 
    </BODY>
    But in a nested table it doesn't line up correctly:

    Code:
    <body>
    <div align="center">
    <table>
         <tr>
              <td>
              <table>
                     <tr>
                         <td>
                         --Some Picture goes here --- 
                         </td>
                    </tr>
              </table> 
              <table>
                      <tr>
                          <td>
                         --Menu Code Goes Here--
                          </td>
                      </tr>
                </table> 
            </td>
         </tr>
    </table>
    
    </BODY>

    Any ideas how to fix it? We've tried setting table and cell heights/cell paddings etc but still doesnt work correctly.

    Thanks.

  2. #2
    Member
    Join Date
    Sep 2005
    Location
    Minehead, Somerset.
    Posts
    197
    Thanks
    0
    Thanked
    0 times in 0 posts
    any ideas all?

  3. #3
    Flower Child stytagm's Avatar
    Join Date
    Aug 2004
    Location
    London
    Posts
    754
    Thanks
    47
    Thanked
    23 times in 18 posts
    I assume you have a good reason for wanting to nest the tables and that your example above is simplified? Other wise the obvious answer is "don't nest the tables".

    Unfortunately the serious answer is not only "Don't nest tables", but also "Don't use tables at all for layout, AND DEFINATELY DON'T NEST TABLES". It's Yukky, honestly. Use a Div instead.

    Assuming you know this, and you've got some kind of tabular arrangement of images and menus (could happen) have you considered putting divs inside the table? Something like:
    Code:
    <body>
    <div align="center">
    <table>
         <tr>
              <td>
                 <div style="some styling stuff">
                    --Some Picture goes here --- 
                 </div>
              </td>
         </tr>
         <tr>
            <td>
               <div style="some styling bits and bobs">
                  --Menu Code Goes Here--
               </div>
            </td>
         </tr>
    </table>
    
    </BODY>
    But better would be
    Code:
    <body>
    <div> <!-- Style this divs to fill the whole space -->
       <div> <!-- style these divs to where you want your menu and picture -->
          -- some picture --
       </div>
       <div>
          -- some menu --
       </div>
    
    </div>
    </body>
    Failing that, there are some bugs in IE's box model, see here: http://en.wikipedia.org/wiki/Interne..._box_model_bug
    They told me I was gullible ... and I believed them.

  4. #4
    Senior Member Kezzer's Avatar
    Join Date
    Sep 2003
    Posts
    4,863
    Thanks
    12
    Thanked
    5 times in 5 posts
    Also, it may be best that you change the topic to "JavaScript" as opposed to "Java". They're two different languages

  5. #5
    Ah, Mrs. Peel! mike_w's Avatar
    Join Date
    Oct 2003
    Location
    Hertfordshire, England
    Posts
    3,326
    Thanks
    3
    Thanked
    9 times in 7 posts
    Yeah, Java in web pages is normally horrid. There again, I'm not a huge fan of people using Javascript all the time (obviously, there are some places where it is suitable). In particular, I would caution again using Javascript for navigation - this means that if somebody doesn't have Javascript, they can't see the menu, which is normally a pretty crucial part of the site.
    "Well, there was your Uncle Tiberius who died wrapped in cabbage leaves but we assumed that was a freak accident."

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. My experience with Windows XP Pro x64 Edition
    By Paul Adams in forum Software
    Replies: 7
    Last Post: 20-04-2007, 11:59 PM
  2. Menu problems
    By zixiazhang in forum Software
    Replies: 3
    Last Post: 05-09-2004, 01:50 AM
  3. Java Problems
    By Applecrusher in forum Software
    Replies: 4
    Last Post: 27-04-2004, 01:12 PM

Posting Permissions

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