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.getElementsByTagN ame('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> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td width="1%"> </td>
<td width="99%"><a href="#" onClick="togglemenu( 'menu1' );" onKeyPress="togglemenu( 'menu1' );">Membership</a> </td>
</tr>
<tr id="menu1" style="display: none;">
<td> </td>
<td nowrap>submenu 1</td>
</tr>
<tr id="menu1" style="display: none;">
<td> </td>
<td nowrap>submenu 2</td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </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>
Any help would be appreciated.
<script type="text/JavaScript">
function togglemenu(submenu)
{
obj = document.getElementsByTagN
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> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td width="1%"> </td>
<td width="99%"><a href="#" onClick="togglemenu( 'menu1' );" onKeyPress="togglemenu( 'menu1' );">Membership</a> </td>
</tr>
<tr id="menu1" style="display: none;">
<td> </td>
<td nowrap>submenu 1</td>
</tr>
<tr id="menu1" style="display: none;">
<td> </td>
<td nowrap>submenu 2</td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2"><img name="banner1_r6_c1" src="images/banner1_r6_c1.
</tr>
</table>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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&
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&
Cd&
ASKER
Just deciding whether or not to split points??
COBAL>>Is the =(document.all)? 'block' : 'table-row'; nessicary??
For what reason..
Thanks again.
Rockman