471,354 Members | 1,266 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,354 software developers and data experts.

Table row does not align correctly in Mozilla when hidden and displayed

shane3341436
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  5. <title>Untitled Document</title>
  6. </head>
  7.  
  8. <body>
  9. <form name="f1">
  10. <table width="1123">
  11.   <!--DWLayoutTable-->
  12. <tr>
  13.  
  14. <td width="160" height="22" valign="middle" class="small_font_grey"> <input type="radio" name="f1" value=0 onclick="selectf2(this.form)"  />
  15.   Hide            </td>
  16. <td width="360" valign="middle" class="small_font_grey"> <input type="radio" name="f1" value=1 onclick="selectf2(this.form)"  /> 
  17.   Show             </td>
  18. <td width="582">&nbsp;</td>
  19. </tr>
  20. <tr  align="center" >
  21.             <td  height="32" align="right" valign="middle" class="td_data_black">Field 1  :&nbsp; </td>
  22.             <td align="left" valign="top"  >
  23.               <input name="f3" type="text" id="f3"   />
  24.             Example 1</td>
  25.             <td  >&nbsp;</td>
  26.     </tr>
  27.  <tr id='divf2' align="center" style="display:none">
  28.             <td  height="32" align="right" valign="middle" class="td_data_black">Field 2  :&nbsp; </td>
  29.             <td align="left" valign="top"  >
  30.               <input name="f2" type="text" id="f2"   />
  31.             Example 2</td>
  32.             <td  >&nbsp;</td>
  33.  </tr>
  34.   </table>
  35. </form>
  36. </body>
  37. </html>
  38. <script>
  39.  
  40. function selectf2(form){
  41.  
  42.         if(form.f1[1].checked==true){
  43.             document.getElementById("divf2").style.display="block";
  44.  
  45.  
  46.         }
  47.         else if(form.f1[0].checked==true){
  48.             document.getElementById("divf2").style.display="none";
  49.  
  50.         }
  51. }
  52. </script>
It runs well on IE7 but not in mozilla. When rendered in mozilla the section which I want to hide and display do not align to same line as that of the upper section. When clicking on view source on mozilla browser the html tags are pretty good. I don't think there are any error. But still creating trouble in mozilla. Plz somebody help me to solve this problem.
Sep 19 '07 #1
6 3349
I used these codes for hiding and displaying an input field using the style property of 'tr' tag.
Sep 19 '07 #2
acoder
16,027 Expert Mod 8TB
Changed the thread title to better describe the problem.

For some reason, the table row is being squashed into one table cell space. I'll have to investigate this further.
Sep 19 '07 #3
Thanks for ur concern. Waiting for reply
Sep 21 '07 #4
acoder
16,027 Expert Mod 8TB
Thanks for ur concern. Waiting for reply
See this link. Firefox needs the display property to be set to "table-row", but since that wouldn't work in IE, use display set to "".
Sep 21 '07 #5
Thanx for ur help. It really does works.
Sep 27 '07 #6
acoder
16,027 Expert Mod 8TB
Glad to hear you got it working. Post again if you have any more questions.
Sep 27 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Chris McGarry | last post: by
1 post views Thread by cotton_gear | last post: by
1 post views Thread by James Black | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.