473,395 Members | 2,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

display:none doesn't work in IE, but works in Firefox

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3.     <head>
  4.         <meta http-equiv="content-type" content="text/html; charset=utf-8">
  5.         <title>Testing</title>
  6.         <meta name="description" content=".">
  7.         <link rel="stylesheet" href="readme_files/screensmall.css" type="text/css" media="screen">
  8.         <script type="text/javascript">
  9.             var totalRow = new Array(0,0);
  10.             var totalCol = new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
  11.             var monthInContext = (new Date()).getMonth()
  12.             var yearInContext = (new Date()).getYear()
  13.  
  14.             function updateTotal(i,j)
  15.             {
  16.                 document.getElementById("gTotal").value = 0
  17.                 var sum = 0
  18.                 document.getElementById("totalRow" + i).value = totalRow[i]
  19.                 for(jj=0;jj<2;jj++)
  20.                 {
  21.                     sum += totalRow[jj]
  22.                 }
  23.                 document.getElementById("gTotal").value = sum
  24.             }
  25.  
  26.             function chkcontrol(name,i,j,c)
  27.             {
  28.                 var td = i+""+(j+1)
  29.                 alert(td)
  30.                 if(c == 'w')
  31.                 {
  32.                     if(name[j].checked == false)
  33.                     {
  34.                         document.getElementById(td).className = 'uncheckedLabel'
  35.                         totalRow[i] += 1;
  36.                         totalCol[j] += 1;
  37.                     }
  38.                     else
  39.                     {
  40.                         document.getElementById(td).className = 'checkedLabel'
  41.                         totalRow[i] -= 1;
  42.                         totalCol[j] -= 1;
  43.                     }
  44.                 }
  45.                 updateTotal(i,j);
  46.             }
  47.         </script>
  48.  
  49.         <style type="text/css">
  50.         .checkedLabel {
  51.     background-color : #FFFFFF;
  52.     background-image : url(chk_on.png);
  53.     }
  54.     .uncheckedLabel {
  55.     background-color : #8EE5EE;
  56.     background-image : url(chk_off.png);
  57.     }
  58.  
  59.         </style>
  60.     </head>
  61.  
  62.     <body>
  63.         <div id="content">
  64.             <center><h1><em>Update Billing details</em></h1></center>
  65.             <b><font color=red>Note:Forget not to save the changes before exiting</font></b>
  66.         </div>
  67.         <div class='section demo'>
  68.             <form name="calForm" method="post">
  69.                 <center><input type="submit" class="form-submit-button" name="save" id="save" value="Save">
  70.                     <input type="button" class="form-button-export" name="export" id="export" value="Export to MSE">
  71.                     <input type="submit" class="form-submit-exit" name="exit" id="exit" value="Exit"></center>
  72.                 <br/>
  73.  
  74.  
  75.                 <%!
  76.                     public int LastDayOfMonth(int Year, int Month) {
  77.                         int i = 31;
  78.                         for (i = 1; i <= 31; i++) {
  79.                             java.util.Date date = new java.util.Date(Year - 1900, Month, i);
  80.                             if (Month != date.getMonth()) {
  81.                                 break;
  82.                             }
  83.                         }
  84.                         return i - 1;
  85.                     }
  86.                 %>
  87.                 <%!    public int noOfDistinctWeeks(int Year, int Month) {
  88.                         int i = 1, firstSunday = 1, lastSunday = LastDayOfMonth(Year, Month), noOfWeeks = 0;
  89.                         for (i = 1; i <= 7; i++) {
  90.                             java.util.Date date = new java.util.Date(Year - 1900, Month, i);
  91.                             if (date.getDay() == 0 && date.getDate() == 1) {
  92.                                 noOfWeeks = noOfSundays(Year, Month);
  93.                                 break;
  94.                             } else if (date.getDay() == 0 && date.getDate() != 1) {
  95.                                 noOfWeeks = noOfSundays(Year, Month) + 1;
  96.                                 break;
  97.                             }
  98.                         }
  99.                         return noOfWeeks;
  100.                     }
  101.                 %>
  102.  
  103.                 <%!    public int noOfSundays(int Year, int Month) {
  104.                         int returnValue = 0;
  105.                         for (int i = 1; i <= LastDayOfMonth(Year, Month); i++) {
  106.                             if ((new java.util.Date(Year - 1900, Month, i)).getDay() == 0) {
  107.                                 returnValue += 1;
  108.                             }
  109.                         }
  110.                         return returnValue;
  111.                     }
  112.                 %>
  113.  
  114.                 <%
  115.                             int[] totalRow = {0, 0};
  116.  
  117.                             String[] arrM = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
  118.                             int[] arrY = new int[5];
  119.                             for (int ii = 0; ii <= 4; ii++) {
  120.                                 arrY[ii] = 2011 - 2 + ii;
  121.                             }
  122.                             String[] arrD = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
  123.                             String text = "";
  124.                             text += "<table ><tr>";
  125.                             text += "<td>";
  126.                             text += "<select name=selMonth id=selMonth>";
  127.                             for (int ii = 0; ii <= 11; ii++) {
  128.                                 if (request.getParameter("selMonth") == null) {
  129.                                     if (ii == (new java.util.Date()).getMonth()) {
  130.                                         text += "<option value= " + ii + " Selected>" + arrM[ii] + "</option>";
  131.                                     } else {
  132.                                         text += "<option value= " + ii + ">" + arrM[ii] + "</option>";
  133.                                     }
  134.                                 } else {
  135.                                     if (ii == Integer.parseInt(request.getParameter("selMonth").toString())) {
  136.                                         text += "<option value= " + ii + " Selected>" + arrM[ii] + "</option>";
  137.                                     } else {
  138.                                         text += "<option value= " + ii + ">" + arrM[ii] + "</option>";
  139.                                     }
  140.                                 }
  141.  
  142.                             }
  143.                             text += "</select>";
  144.                             text += "</td>";
  145.                             text += "<td>";
  146.                             text += "<select name=selYear id=selYear>";
  147.                             for (int ii = 0; ii <= 4; ii++) {
  148.                                 if (request.getParameter("selYear") == null) {
  149.                                     if (ii == 2) {
  150.                                         text += "<option value= " + arrY[ii] + " Selected>" + arrY[ii] + "</option>";
  151.                                     } else {
  152.                                         text += "<option value= " + arrY[ii] + ">" + arrY[ii] + "</option>";
  153.                                     }
  154.                                 } else {
  155.                                     if (ii == Integer.parseInt(request.getParameter("selYear").toString()) - 2009) {
  156.                                         text += "<option value= " + arrY[ii] + " Selected>" + arrY[ii] + "</option>";
  157.                                     } else {
  158.                                         text += "<option value= " + arrY[ii] + ">" + arrY[ii] + "</option>";
  159.                                     }
  160.                                 }
  161.                             }
  162.                             text += "</select>";
  163.                             text += "</td>";
  164.                             text += "<td>";
  165.                             text += "<input type=submit class=form-submit-go name=go id=go value=Go></center>";
  166.                             text += "</td>";
  167.                             text += "</tr></table>";
  168.  
  169.                             int done = 0;
  170.                             java.util.Date now = new java.util.Date();
  171.                             int mm = now.getMonth();
  172.                             int yyyy = now.getYear() + 1900;
  173.  
  174.                             if (request.getParameter("go") != null) {
  175.                                 String button = request.getParameter("go").toString();
  176.                                 if (button.equals("Go")) {
  177.                                     mm = Integer.parseInt(request.getParameter("selMonth"));
  178.                                     yyyy = Integer.parseInt(request.getParameter("selYear"));
  179.                                     now = new java.util.Date(yyyy - 1900, mm, 1);
  180.                                 }
  181.                             }
  182.                             int holidayArraySize = 0;
  183.                             int dd = now.getDate();
  184.                             int diffFromFirstDate = dd - 1;
  185.                             int dow = (now.getDay() >= diffFromFirstDate) ? (now.getDay() - diffFromFirstDate) : (7 + now.getDay() - (diffFromFirstDate%7));
  186.                             int[] holidayArray = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  187.                             for (int i = 1; i <= LastDayOfMonth(yyyy, mm); i++) {
  188.                                 java.util.Date anyDate = new java.util.Date(yyyy - 1900, mm, i);
  189.                                 int anyDay = anyDate.getDay();
  190.                                 if (anyDay == 0 || anyDay == 6) {
  191.                                     holidayArray[holidayArraySize] = i;
  192.                                     holidayArraySize++;
  193.                                 }
  194.                             }
  195.                             int low = LastDayOfMonth(yyyy, mm);
  196.                             low = new java.util.Date(yyyy - 1900, mm, LastDayOfMonth(yyyy, mm)).getDay();
  197.                             int aa = 1;
  198.  
  199.  
  200.  
  201.                             text += "<table border=1>";
  202.                             text += "<tr>";
  203.                             text += "<td align=center bgcolor=#FFFACD><span class=label>Employee-Days</span></td>";
  204.                             for (int jj = 1; jj <= noOfDistinctWeeks(yyyy, mm); jj++) {
  205.                                 if (jj == 1) {
  206.                                     for (int ii = dow; ii <= 6; ii++) {
  207.                                         text += "<td align=center bgcolor=#FFFACD><span class=label>" + arrD[ii] + "<BR>" + aa + "</span></td>";
  208.                                         aa++;
  209.                                     }
  210.                                 } else if (jj == noOfDistinctWeeks(yyyy, mm)) {
  211.                                     for (int ii = 0; ii <= low; ii++) {
  212.                                         text += "<td align=center bgcolor=#FFFACD><span class=label>" + arrD[ii] + "<BR>" + aa + "</span></td>";
  213.                                         aa++;
  214.                                     }
  215.                                 } else {
  216.                                     for (int ii = 0; ii <= 6; ii++) {
  217.                                         text += "<td align=center bgcolor=#FFFACD><span class=label>" + arrD[ii] + "<BR>" + aa + "</span></td>";
  218.                                         aa++;
  219.                                     }
  220.                                 }
  221.                             }
  222.                             text += "<td align=center bgcolor=#FFFACD><span class=label>Total</span></td>";
  223.                             text += "</tr>";
  224.                             for (int i = 0; i < 2; i++) {
  225.                                 text += "<tr>";
  226.                                 text += "<td align=center><span class=label>Arjun</span></td>";
  227.                                 for (int ii = 1; ii <= LastDayOfMonth(yyyy, mm); ii++) {
  228.                                     for (int jj = 0; jj < holidayArraySize; jj++) {
  229.                                         if (holidayArray[jj] == (ii)) {
  230.                                             if(request != null && request.getParameter("browser") != null && (0 == Integer.parseInt(request.getParameter("browser").toString())))
  231.                                                 text += "<td align=center style=" + "background-color:#BEBEBE" + "><label><input type=text disabled=" + "true" + " style=\"display:block;width:0\" name='ckb" + i + "' value=" + (ii - 1) + " onclick=chkcontrol(ckb" + i + "," + i + "," + (ii - 1) + ",'h');></label></td>";
  232.                                             else
  233.                                                 text += "<td align=center style=" + "background-color:#BEBEBE" + "><label><input type=text disabled=" + "true" + " style=\"display:none\" name='ckb" + i + "' value=" + (ii - 1) + " onclick=chkcontrol(ckb" + i + "," + i + "," + (ii - 1) + ",'h');></label></td>";
  234.                                             done = 1;
  235.                                             break;
  236.                                         }
  237.                                     }
  238.                                     if (done == 0) {
  239.                                         if(request != null && request.getParameter("browser") != null && (0 == Integer.parseInt(request.getParameter("browser").toString())))
  240.                                             text += "<td id='" + i + "" + ii + "' align=center><label><input type=checkbox style=\"display:block;width:0\" checked=\"checked\" name='ckb" + i + "' value=" + (ii - 1) + " onclick=chkcontrol(ckb" + i + "," + i + "," + (ii - 1) + ",'w');></label></td>";
  241.                                         else
  242.                                             text += "<td id='" + i + "" + ii + "' align=center><label><input type=checkbox style=\"display:none\" checked=\"checked\" name='ckb" + i + "' value=" + (ii - 1) + " onclick=chkcontrol(ckb" + i + "," + i + "," + (ii - 1) + ",'w');></label></td>";
  243.                                     } else {
  244.                                         done = 0;
  245.                                     }
  246.                                 }
  247.                                 text += "<td align=center style=" + "background-color:#BEBEBE" + "><label><input type=textbox id='totalRow" + i + "' value=" + totalRow[i] + "></label></td>";
  248.                                 text += "</tr>";
  249.                             }
  250.                             text += "<tr>";
  251.                             text += "<b><font color=red>Grand Total of leave days:&nbsp &nbsp &nbsp &nbsp</font></b><input type=textbox id=gTotal value=0>";
  252.                             text += "</tr>";
  253.                             text += "</table>";
  254.                 %>
  255.                 <%=text%>
  256.  
  257.                 <br/>
  258.                 <center><input type="submit" class="form-submit-button" name="submit" id="submit" value="Save">
  259.                     <input type="button" class="form-button-export" name="export" id="export" value="Export to MSE">
  260.                     <input type="submit" class="form-submit-exit" name="exit" id="exit" value="Exit"></center>
  261.  
  262.             </form>
  263.         </div>
  264.  
  265.     </body>
  266. </html>
If I replace the display:none with display:block;width:0 of the style attribute, it works fine in IE but doesn't work in firefox. Can anyone help me here? Thanks.
Mar 13 '11 #1
0 1874

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

Similar topics

5
by: LRW | last post by:
(Sorry if this is a repost...my newsreader keeps crashing on the posting--I don't know if the message going out or not) For some reason this javascript just won't work in Firefox. It works fine...
6
by: Cliff R. | last post by:
Hi, I use a handy little Javascript Flash detection script on a number of sites (copied below). Usually works great, but I just started trying Firefox and it's not working. A few browsers are...
3
by: Iain Hallam | last post by:
Hi. I've been using display:none on the style property of some <option> elements in my forms, which works fine with Mozilla - as expected it removes the option from my dropdown (although it...
4
by: Joe | last post by:
Hello, I have created a login page using dotnet. I am using requiredFieldValidator and noticed that the code works fine in IE but not in Netscape, Opera, Mozilla, Firefox, etc. For example...
2
by: Steve Ford | last post by:
I have a datagrid that contains the following template column: <ItemTemplate> <asp:HyperLink ID="partyColour" Runat="server" BackColor='<%#...
21
by: briggs | last post by:
<html> <head> <script> /* AddChild */ function ac() { var c; var p = document.getElementById("p"); for (var i = 0; i < 5; i++) { c = document.createElement("DIV"); // Create 'div' element.
2
by: Jake Barnes | last post by:
Imagine I've this block of HTML: <p>Alex Schein Mailing List <input type="checkbox" name="newslettersToUse" value="133156"> (<a href="mcControlPanel.php"...
5
by: libsfan01 | last post by:
function switch_display(switchme) { var el = document.getElementById(switchme); el.style.display = (el.style.display == 'none')? '' : 'none'; } im using this function to switch the display on...
1
by: sva0008 | last post by:
i have a auto suggest script that does not work in firefox , works great on IE. /******************************************************* AutoSuggest - a javascript automatic text input...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.