Link to home
Start Free TrialLog in
Avatar of rockmansattic
rockmansattic

asked on

javascript/table spacing and Firefox problem

I have this little javascript working that expands the table rows to show submenus.  My problem is that it really screws up the spacing in Firefox.  Works Great in IE.

Any help would be appreciated.

<script type="text/JavaScript">
function togglemenu(submenu)
{
     obj = document.getElementsByTagName('tr');
        for (i=0; i<obj.length; i++)
     {
          if (obj[i].id == submenu)
                    if (obj[i].style.display == 'none')
                      obj[i].style.display = 'block';
                  else obj[i].style.display = 'none';
     }
     
}
//-->
</script>

<table style="width: 100%;"  border="0" cellpadding="0" cellspacing="0" class="menu_background">
                <tr>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <td width="1%">&nbsp;</td>
                  <td width="99%"><a href="#" onClick="togglemenu( 'menu1' );" onKeyPress="togglemenu( 'menu1' );">Membership</a> </td>
                </tr>
                <tr id="menu1" style="display: none;">
                  <td>&nbsp;</td>
                  <td nowrap>submenu 1</td>
                </tr>
                <tr id="menu1" style="display: none;">
                  <td>&nbsp;</td>
                  <td nowrap>submenu 2</td>
                </tr>

                <tr>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <td colspan="2"><img name="banner1_r6_c1" src="images/banner1_r6_c1.jpg" width="121" height="15" border="0" alt=""></td>
                </tr>
</table>
ASKER CERTIFIED SOLUTION
Avatar of seanpowell
seanpowell
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rockmansattic
rockmansattic

ASKER

Thank you both, SeanPowell's comment works and it was first..

Just deciding whether or not to split points??  

COBAL>>Is the =(document.all)? 'block' : 'table-row'; nessicary??
For what reason..

Thanks again.

Rockman
Within the standards, the correct display is table-row.  Using display='' cause default display behaviour but there is no guarantee that default behaviour in the future will be the same cross-browser because MS has move away from strong support of teh complex table model in the dom, in favour of the activex driven databinding that it makes to make .net viable.

I have always figured that if you declare things to be what the are you will get fewer nasty surprises as browsers and other software slowly mirgrate to hager levels of standards compliance.

Cd&
Glad we could help.  Thanks for the A... and fo rmaking me number one in the Topic. :^)

Cd&