471,309 Members | 950 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Firefox browser style.display issue (IE works fine)

1
I have a dropdown which calls SetTimePeriod method on change the selection. In the JS function, I reset the field style.display based on what the selection is. This works fine with IE but not working with Firefox browser.

The firefox browser has problem to display a field after its style.display is reset. At the end of the JS function, I printed out the fields style.display value. They are set correctly. How to resovle this?

My JS is :

Expand|Select|Wrap|Line Numbers
  1. function SetTimePeriod(reportTimePeriod, reportTypeName, fromProfile) {
  2.        var odate = document.getElementById('odate'); // id for td
  3.        var sdate = document.getElementById('sdate'); // id for td      
  4.        var ddate = document.getElementById('ddate');  // id for div     
  5.        var startday = document.getElementById('startday');  // id for div            
  6.        var periodLabel = document.getElementById('periodLabel');  // id for td     
  7.        var periodList = document.getElementById('periodList');  // id for div            
  8.  
  9.     if(condition){
  10.        periodLabel.style.display="none";
  11.        periodList.style.display="none";
  12.        ddate.style.display="block";       
  13.        startday.style.display="none";
  14.        odate.style.display="block";
  15.        sdate.style.display="none";
  16.    }else{
  17.        periodLabel.style.display="block";
  18.        periodList.style.display="block";
  19.         startday.style.display="none";
  20.         ddate.style.display="none";  
  21.         odate.style.display="none";
  22.         sdate.style.display="none";
  23.     }
  24.     alert(" SetTimePeriod - periodLabel = "+periodLabel.style.display+" - periodList = "+periodList.style.display+" - odate = "+odate.style.display+" - sdate="+sdate.style.display+" - ddate="+ddate.style.display+" - startday="+startday.style.display);
  25.   }
  26.  
Thanks,
ry
Sep 1 '06 #1
1 8765
acoder
16,027 Expert Mod 8TB
For a table cell (td element), the correct style.display setting is "table-cell". Unfortunately, this is not supported in IE which uses "block" instead.

To work around this, set style.display to the empty string "" which should set it to the default display.
May 9 '08 #2

Post your reply

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

Similar topics

4 posts views Thread by cjaserver | last post: by
1 post views Thread by Brian D | last post: by
reply views Thread by rosydwin | 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.