By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,680 Members | 2,173 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,680 IT Pros & Developers. It's quick & easy.

Firefox browser style.display issue (IE works fine)

P: 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
Share this Question
Share on Google+
1 Reply


acoder
Expert Mod 15k+
P: 16,027
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.