Problem with "select All" option
<p>The problem with the below code is that Select All options works very well in Mozilla and not in Internet Explorer. </p>

<pre><code>&lt;!-- 
Document   : DG
Created on : Sep 11, 2008, 12:48:37 PM
Author     : padmaja
--&gt;
&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;script type="text/javascript"&gt;
&lt;!--
var months = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
var daysInMonth = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
var days = new Array("S", "M", "T", "W", "T", "F", "S");

today = new getToday(); 
var element_id;

function getDays(month, year) 
{
// Test for leap year when February is selected.
if (1 == month)
    return ((0 == year % 4) &amp;&amp; (0 != (year % 100))) ||
     (0 == year % 400) ? 29 : 28;
else
    return daysInMonth[month];
}

function getToday()
{
// Generate today's date.
this.now = new Date();
this.year = this.now.getFullYear() ; // Returned year XXXX
this.month = this.now.getMonth();
this.day = this.now.getDate();
}


function newCalendar() 
{
var parseYear = parseInt(document.all.year  [document.all.year.selectedIndex].text);

var newCal = new Date(parseYear , document.all.month.selectedIndex, 1);
var day = -1;
var startDay = newCal.getDay();
var daily = 0; 

today = new getToday(); // 1st call
if ((today.year == newCal.getFullYear() ) &amp;&amp;   (today.month == newCal.getMonth()))
   day = today.day;
// Cache the calendar table's tBody section, dayList.
var tableCal = document.all.calendar.tBodies.dayList;

var intDaysInMonth =
   getDays(newCal.getMonth(), newCal.getFullYear() );

for (var intWeek = 0; intWeek &lt; tableCal.rows.length;  intWeek++)
       for (var intDay = 0;
      intDay &lt; tableCal.rows[intWeek].cells.length;
      intDay++)
 {
      var cell = tableCal.rows[intWeek].cells[intDay];

      // Start counting days.
      if ((intDay == startDay) &amp;&amp; (0 == daily))
      daily = 1;

      // Highlight the current day.
      cell.style.color = (day == daily) ? "red" : "";
      if(day == daily)
      {
      document.all.todayday.innerText= "Today: " +  day + "/" + 
       (newCal.getMonth()+1) + "/" + newCal.getFullYear() ;
      }
      // Output the day number into the cell.
      if ((daily &gt; 0) &amp;&amp; (daily &lt;= intDaysInMonth))
      cell.innerText = daily++;
      else
      cell.innerText = "";
   }

}

 function getTodayDay()
 {
      document.all[element_id].value = today.year + "/" + (today.month+1) + 
       "/" + today.day; 
      //document.all.calendar.style.visibility="hidden";
      document.all.calendar.style.display="none";
      document.all.year.selectedIndex =100;   
      document.all.month.selectedIndex = today.month; 
 }

    function getDate() 
     {
     // This code executes when the user clicks on a day
     // in the calendar.
     if ("TD" == event.srcElement.tagName)
        // Test whether day is valid.
        if ("" != event.srcElement.innerText)
        { 
       var mn = document.all.month.selectedIndex+1;
       var Year = document.all.year [document.all.year.selectedIndex].text;
      document.all[element_id].value=Year +"-"+mn+"-"+event.srcElement.innerText;
       document.all.calendar.style.display="none";
      }
     }

function GetBodyOffsetX(el_name, shift)
{
var x;
var y;
x = 0;
y = 0;

var elem = document.all[el_name];
do 
{
    x += elem.offsetLeft;
    y += elem.offsetTop;
    if (elem.tagName == "BODY")
     break;
    elem = elem.offsetParent; 
} while  (1 &gt; 0);

shift[0] = x;
shift[1] = y;
return  x;
}   

function SetCalendarOnElement(el_name)
{
if (el_name=="") 
el_name = element_id;
var shift = new Array(2);
GetBodyOffsetX(el_name, shift);
document.all.calendar.style.pixelLeft  = shift[0]; //  - document.all.calendar.offsetLeft;
document.all.calendar.style.pixelTop = shift[1] + 25 ;
}



function ShowCalendar(elem_name)
{
    if (elem_name=="")
    elem_name = element_id;

    element_id = elem_name; // element_id is global variable
    newCalendar();
    SetCalendarOnElement(element_id);
    //document.all.calendar.style.visibility = "visible";
    document.all.calendar.style.display="inline";
}

function HideCalendar()
{
//document.all.calendar.style.visibility="hidden";
document.all.calendar.style.display="none";
}

function toggleCalendar(elem_name)
{
//if (document.all.calendar.style.visibility == "hidden")
if(document.all.calendar.style.display=="none")
    ShowCalendar(elem_name);
else 
    HideCalendar();
}
--&gt;
&lt;/script&gt;

&lt;style&gt;
.today {COLOR: black; FONT-FAMILY: sans-serif; FONT-SIZE: 10pt; FONT-WEIGHT: bold}
.days {COLOR: navy; FONT-FAMILY: sans-serif; FONT-SIZE: 10pt; FONT-WEIGHT: bold; TEXT-ALIGN: center}
.dates {COLOR: black; FONT-F

AMILY: sans-serif; FONT-SIZE: 10pt}
&lt;/style&gt;
&lt;/head&gt;

    &lt;body bgcolor="#FFF8DC"&gt; 
     &lt;h5&gt;Diesel Generators&lt;/h5&gt;&lt;br&gt;&lt;br&gt;
      &lt;br&gt;
       &lt;br&gt;
        &lt;script language="JavaScript"&gt;
function toggle(source) {
  checkboxes = document.getElementsByName('DG1');
  for each(var checkbox in checkboxes)
    checkbox.checked = source.checked;
  checkboxes = document.getElementsByName('DG2');
  for each(var checkbox in checkboxes)
    checkbox.checked = source.checked;
    checkboxes = document.getElementsByName('DG3');
  for each(var checkbox in checkboxes)
    checkbox.checked = source.checked;
  checkboxes = document.getElementsByName('DG4');
  for each(var checkbox in checkboxes)
    checkbox.checked = source.checked;
     checkboxes = document.getElementsByName('DG5');
  for each(var checkbox in checkboxes)
    checkbox.checked = source.checked;
}
&lt;/script&gt;

&lt;input type="checkbox" onClick="toggle(this)" /&gt; Select  All&lt;br/&gt;

&lt;form method=POST action="DGUsageServlet"&gt;

&lt;INPUT TYPE="CHECKBOX" name="DG1"&gt;DG1
&lt;INPUT TYPE="CHECKBOX" name="DG2"&gt;DG2
&lt;INPUT TYPE="CHECKBOX" name="DG3"&gt;DG3
&lt;INPUT TYPE="CHECKBOX" name="DG4"&gt;DG4
&lt;INPUT TYPE="CHECKBOX" name="DG5"&gt;DG5

&lt;br&gt;
&lt;br&gt;
&lt;INPUT TYPE=TEXT NAME="StartDate"&gt;
    &lt;a href="JavaScript:;" onClick="toggleCalendar('StartDate')"&gt;StartDate&lt;/a&gt;
&lt;INPUT TYPE=TEXT NAME="EndDate"&gt;
     &lt;a href="JavaScript:;" onClick="toggleCalendar('EndDate')"&gt;EndDate&lt;/a&gt;
&lt;input name=plotgraph value=plotgraph align="CENTER" type=submit&gt;
&lt;/form&gt;
&lt;TABLE bgColor=#ffffff border=1 cellPadding=0 cellSpacing=3 id=calendar style="DISPLAY: none; POSITION: absolute; Z-INDEX: 4"&gt;
  &lt;TBODY&gt;
  &lt;TR&gt;
    &lt;TD colSpan=7 vAlign=center&gt;
    &lt;!-- Month combo box --&gt;
    &lt;SELECT id=month onchange=newCalendar()&gt; 
     &lt;script type="text/javascript"&gt;
     // Output months into the document.
     // Select current month.
     for (var intLoop = 0; intLoop &lt; months.length; intLoop++)
      document.write("&lt;OPTION " + (today.month == intLoop ? "Selected" : "") + "&gt;" + months[intLoop]);
     &lt;/SCRIPT&gt;
    &lt;/SELECT&gt; 
    &lt;!-- Year combo box --&gt;
    &lt;SELECT id=year onchange=newCalendar()&gt; 
     &lt;script type="text/javascript"&gt;
     // Output years into the document.
     // Select current year.
     for (var intLoop = 1900; intLoop &lt; 2028; intLoop++)
      document.write("&lt;OPTION " + (today.year == intLoop ? "Selected" : "") + "&gt;" + intLoop);
     &lt;/SCRIPT&gt;
    &lt;/SELECT&gt; 

    &lt;/TD&gt;
  &lt;/TR&gt;



  &lt;TR class=days&gt;
    &lt;!-- Generate column for each day. --&gt;
    &lt;script type="text/javascript"&gt;
    // Output days.
    for (var intLoop = 0; intLoop &lt; days.length; intLoop++)
     document.write("&lt;TD&gt;" + days[intLoop] + "&lt;/TD&gt;");
    &lt;/SCRIPT&gt;
  &lt;/TR&gt;


  &lt;TBODY class=dates id=dayList onclick="getDate('')" vAlign=center&gt;
  &lt;!-- Generate grid for individual days. --&gt;
  &lt;script type="text/javascript"&gt;
    for (var intWeeks = 0; intWeeks &lt; 6; intWeeks++)
    {
     document.write("&lt;TR&gt;");
     for (var intDays = 0; intDays &lt; days.length; intDays++)
      document.write("&lt;TD&gt;" +intDays+ "&lt;/TD&gt;");

     document.write("&lt;/TR&gt;");
    }
  &lt;/SCRIPT&gt;

  &lt;!-- Generate today day. --&gt;&lt;/TBODY&gt;
  &lt;TBODY&gt;
  &lt;TR&gt;
    &lt;TD class=today colSpan=5 id=todayday onclick=getTodayDay()&gt;&lt;/TD&gt;
    &lt;TD align=right colSpan=2&gt;&lt;A href="javascript:HideCalendar();"&gt;&lt;SPAN style="COLOR: black; FONT-SIZE: 10px"&gt;&lt;B&gt;Hide&lt;/B&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;/TD&gt;
  &lt;/TR&gt;
  &lt;/TBODY&gt;

&lt;/TABLE&gt;



&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>Please guide me</p>

<p>Thanks in advance.</p>
