Javascript compatibility issue for IE
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/8214384/compatibility-issue-for-ie-javascript">compatibility issue for IE (Javascript)</a>  </p>
</blockquote>



<p>When I visited the page with IE browser, there is a table become unclickable. but it is supposed to be clickable. It shows right with firefox and Chrome. I attached the code as follows. The unclickable table is from line 450 to 456. hope someone can help me to find the problem. thanks</p>

<pre><code>    &lt;script type="text/javascript"&gt;
      var roomdisplayed = -1;
      var checkedcount;
      var selectactionlistoptions;
      var selectactionbutton;
      var checkselect;

      function displayRoom(obj)
      {
        if(roomdisplayed &gt; 0)
        {
          roomElement = document.getElementById('room');
          if(roomElement != null) {
            roomElement.value = obj.value;
          }

          var room = document.getElementById('view[room' + roomdisplayed + ']');
          room.style.display = 'none';

          roomdisplayed = obj.id.substr(4);
          room = document.getElementById('view[room' + roomdisplayed + ']');
          room.style.display = 'block';
        }
      }

      function validateDelete(roomname)
      {
        var confirm = window.confirm("Are you sure you want to delete room '" + roomname + "'?");

        return confirm;
      }

      function confirmFormSubmit() {
        if(document.getElementById("selectactionlist").value == "deleteAppointmentTimes") {
          return window.confirm("Are you sure you want to delete the selected time(s)?");
        }
        else {
          return true;
        }
      }

      function checkboxSelect(event, obj)
      {
        if(checkselect == null || !event.shiftKey)
        {
          checkselect = obj;
        }
        else
        {
          betweenCheckBoxSelection(checkselect, obj, obj.checked);
          checkselect = null;
        }
      }

      function betweenCheckBoxSelection(a, b, check)
      {
        if(a.form == b.form)
        {
          var form = a.form;
          var elements = form.elements;

          var selectionelements = new Array();
          var i;
          var elementinbetween = false;
          for(i=0; i&lt;elements.length; i++)
          {
            if(elements[i].type == "checkbox")
            {
              if(elementinbetween)
              {
                selectionelements.push(i);
              }

              if(elements[i] == a || elements[i] == b)
              {
                elementinbetween = !elementinbetween;
              }
            }
          }

          if(!elementinbetween)
          {
            for(i=0; i&lt;selectionelements.length; i++)
            {
              if(elements[selectionelements[i]].checked != check)
              {
                elements[selectionelements[i]].checked = check;
                if(check)
                  checkedcount++;
                else
                  checkedcount--;
              }
            }
          }
        }
      }

      function recalcSelection(obj)
      {
        if(obj != null &amp;&amp; obj.tagName == "INPUT" &amp;&amp; obj.type == "checkbox")
        {
          if(obj.checked)
            checkedcount++;
          else
            checkedcount--;
        }

        var selected = null;
        var numberdisabled = 0;
        for(i in selectactionlistoptions)
        {
          if(checkedcount &lt;= 0)
          {
            selectactionlistoptions[i].disabled = true;
            numberdisabled++;
          }
          else if(checkedcount &lt;= 1)
          {
            selectactionlistoptions[i].disabled = false;
          }
          else
          {
            if(selectactionlistoptions[i].value == "editAppointmentTime")
            {
              selectactionlistoptions[i].disabled = true;
              numberdisabled++;
            }
            else
            {
              selectactionlistoptions[i].disabled = false;
            }
          }

          if(selectactionlistoptions[i].selected)
          {
            selected = selectactionlistoptions[i];
          }
        }

        if(selected.disabled)
        {
          for(i in selectactionlistoptions)
          {
            if(selected.disabled)
            {
              if(!selectactionlistoptions[i].disabled)
              {
                selectactionlistoptions[i].selected = true;
                selected = selectactionlistoptions[i];
              }
            }
          }
        }

        if(numberdisabled &gt;= selectactionlistoptions.length)
        {
          selectactionbutton.disabled = true;
        }
        else
        {
          selectactionbutton.disabled = false;
        }
      }

      $(document).ready(function()
      {
        var room;
        if(room = document.getElementById('view[room1]'))
        {
          roomdisplayed = 1;
          room.style.display = 'block';

          var roomnum = 2;
          while(room = document.getElementById('view[room' + roomnum + ']'))
          {
            room.style.display = 'none';
            roomnum++;
          }
        }

        checkselect = null;
        checkedcount = 0;

        var selectactionlist = document.getElementById("selectactionlist");
        if(selectactionlist != null)
        {
          selectactionlistoptions = selectactionlist.options;
          selectactionbutton = document.getElementById("selectactionbutton");
        }

        var listform = document.getElementById("selectionform");
        if(listform != null)
        {
          var inputs = listform.elements;
          for(i in inputs)
          {
            if(inputs[i].type == "checkbox")
            {
              if(inputs[i].checked)
              {
                checkedcount++;
              }

              inputs[i].onclick = function(event) {
                var evt = window.event || event;

                checkboxSelect(evt, this);
                recalcSelection(this);
              }
            }
          }
          recalcSelection();
        }

        $("#register_close_date").datepicker({
          maxDate: new Date($("#appointment_date").val())
        });

        $("#appointment_date").datepicker().change(function() {
          $("#register_close_date").datepicker('option', 'maxDate', new Date($(this).val()));
        });

        $("#hide_until_date").datepicker();
      });
    &lt;/script&gt;
    &lt;div id="appfeaturescontainer"&gt;
      &lt;table&gt;
        &lt;tbody class="bodyseparator"&gt;
          &lt;form method="POST"&gt;
            &lt;input type="hidden" name="action" value="buttonToActionMapper" /&gt;
            &lt;input type="hidden" name="current_action" value="editAppointment" /&gt;
            &lt;input type="hidden" name="appointmentid" value="&lt;?php echo $appointment["id"]; ?&gt;" /&gt;
            &lt;tr class="separator"&gt;
              &lt;td style="width:300px;"&gt;Client:&lt;/td&gt;
              &lt;td&gt;
                &lt;select name="client_id"&gt;
                  &lt;?php  foreach($clients as $client) {  ?&gt;
                    &lt;option value="&lt;?php echo $client["id"]; ?&gt;" &lt;?php echo $appointment["client"]["id"] == $client["id"] ? 'selected="selected"' : ''; ?&gt;&gt;&lt;?php echo $client["fullname"]; ?&gt;&lt;/option&gt;
                  &lt;?php  }  ?&gt;
                &lt;/select&gt;
              &lt;/td&gt;
            &lt;/tr&gt;

            &lt;tr&gt;
              &lt;td&gt;Date:&lt;/td&gt;
              &lt;td&gt;&lt;input id="appointment_date" type="text" name="date" value="&lt;?php echo $appointment["date"]; ?&gt;" /&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr class="separator"&gt;
              &lt;td&gt;Location:&lt;/td&gt;
              &lt;td&gt;&lt;input type="text" name="location"  value="&lt;?php echo $appointment["location"]; ?&gt;" /&gt;&lt;/td&gt;
            &lt;/tr&gt;

            &lt;tr class="separator"&gt;
              &lt;td&gt;Description:&lt;/td&gt;
              &lt;td&gt;&lt;textarea name="description"&gt;&lt;?php echo $appointment["description"]; ?&gt;&lt;/textarea&gt;&lt;/td&gt;
            &lt;/tr&gt;

            &lt;tr&gt;
              &lt;td&gt;Type:&lt;/td&gt;
              &lt;td&gt;
                &lt;select size="&lt;?php echo count($appointment_types); ?&gt;" name="typeid"&gt;
                  &lt;?php  foreach($appointment_types as $appointment_type) {  ?&gt;
                    &lt;option value="&lt;?php echo $appointment_type["id"]; ?&gt;" &lt;?php echo $appointment["type"]["id"] == $appointment_type["id"] ? 'selected="selected"' : ''; ?&gt;&gt;&lt;?php echo $appointment_type["name"]; ?&gt;&lt;/option&gt;
                  &lt;?php  }  ?&gt;
                &lt;/select&gt;
              &lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
              &lt;td&gt;Hide Until Date:&lt;/td&gt;
              &lt;td&gt;&lt;input id="hide_until_date" type="text" name="hide_until_date" value="&lt;?php echo $appointment["hide_until_date"]; ?&gt;" /&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
              &lt;td&gt;Show Descriptions for Extra Tests on User Registration:&lt;/td&gt;
              &lt;td&gt;&lt;input type="checkbox" name="show_tests_descriptions" value="1" &lt;?php echo $appointment["show_tests_descriptions"] ? 'checked="checked"' : ''; ?&gt;/&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
              &lt;td&gt;Show Time Zone:&lt;/td&gt;
              &lt;td&gt;&lt;input type="checkbox" name="show_time_zone" value="1" &lt;?php echo $appointment["show_time_zone"] ? 'checked="checked"' : ''; ?&gt;/&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
              &lt;td&gt;Time Zone:&lt;/td&gt;
              &lt;td&gt;
                &lt;select name="time_zone"&gt;
                  &lt;?php  foreach($time_zones as $val =&gt; $time_zone) {  ?&gt;
                    &lt;option value="&lt;?php echo $val; ?&gt;" &lt;?php echo $val == $appointment["time_zone"] ? 'selected="selected"' : ''; ?&gt;&gt;&lt;?php echo $time_zone; ?&gt;&lt;/option&gt;
                  &lt;?php  }  ?&gt;
                &lt;/select&gt;
              &lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
              &lt;td&gt;Display Military:&lt;/td&gt;
              &lt;td&gt;&lt;input type="checkbox" name="militarytime" value="1" &lt;?php echo $appointment["militarytime"] ? 'checked="checked"' : ''; ?&gt;/&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
              &lt;td&gt;Hide Tests on User Time Selection:&lt;/td&gt;
              &lt;td&gt;&lt;input type="checkbox" name="hide_tests_on_time_table" value="true" &lt;?php echo $appointment["hide_tests_on_time_table"] ? 'checked="checked"' : ''; ?&gt;/&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
              &lt;td&gt;Close Registration Date:&lt;/td&gt;
              &lt;td&gt;
                Date: &lt;input id="register_close_date" type="text" name="register_close_date" value="&lt;?php echo $appointment['close_registration']['date']; ?&gt;" /&gt;
                Time: &lt;input type="text" name="register_close_time" value="&lt;?php echo $appointment['close_registration']['time']; ?&gt;" /&gt;
              &lt;/td&gt;
            &lt;/tr&gt;
            &lt;?php  /*&lt;tr&gt;
              &lt;td&gt;Wait List:&lt;/td&gt;
              &lt;td&gt;&lt;input type="checkbox" name="waitlist" value="1" {$appointment["waitlist"] ? 'checked="checked"' : ''}/&gt;&lt;/td&gt;
            &lt;/tr&gt; */  ?&gt;
            &lt;tr class="saveappointment"&gt;
              &lt;td colspan="2"&gt;&lt;input type="submit" name="button" value="Save Appointment" /&gt;&lt;/td&gt;
            &lt;/tr&gt;

            &lt;input type="hidden" name="appointmentid" value="&lt;?php echo $appointment["id"]; ?&gt;" /&gt;
            &lt;tr class="center"&gt;
              &lt;td colspan="2"&gt;Add Room and/or Nurse:&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
              &lt;td&gt;Name:&lt;/td&gt;
              &lt;td&gt;
                &lt;?php  if($showwebphonenurselist) {  ?&gt;
                &lt;select name="room"&gt;
                  &lt;?php  foreach($webphonenurses as $nursename) {  ?&gt;
                  &lt;option value="&lt;?php echo $nursename; ?&gt;"&gt;&lt;?php echo $nursename; ?&gt;&lt;/option&gt;
                  &lt;?php  }  ?&gt;
                &lt;/select&gt;
                &lt;?php  } else if($showcoachlist) {  ?&gt;
                &lt;select name="room"&gt;
                  &lt;?php  foreach($coaches as $coachname) {  ?&gt;
                  &lt;option value="&lt;?php echo $coachname; ?&gt;"&gt;&lt;?php echo $coachname; ?&gt;&lt;/option&gt;
                  &lt;?php  }  ?&gt;
                &lt;/select&gt;
                &lt;?php  } else {  ?&gt;
                  &lt;input id="room" type="text" name="room" value="TBA" /&gt;
                &lt;?php  }  ?&gt;
              &lt;/td&gt;
            &lt;tr&gt;
            &lt;tr&gt;
              &lt;td&gt;Start Time:&lt;/td&gt;
              &lt;td&gt;&lt;input type="text" name="starttime" value="&lt;?php echo $new_room["starttime"]; ?&gt;" /&gt;&lt;/td&gt;
            &lt;tr&gt;
              &lt;td&gt;End Time:&lt;/td&gt;
              &lt;td&gt;&lt;input type="text" name="endtime" value="&lt;?php echo $new_room["endtime"]; ?&gt;" /&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
              &lt;td&gt;Increment:&lt;/td&gt;
              &lt;td&gt;&lt;input type="text" name="increment" value="&lt;?php echo $new_room["increment"]; ?&gt;" /&gt; minutes&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
              &lt;td&gt;Default # of Slots:&lt;/td&gt;
              &lt;td&gt;
                &lt;select name="defaultslots"&gt;
                &lt;?php  for($i=0; $i&lt;=40; $i++) {  ?&gt;
                  &lt;option value="&lt;?php echo $i; ?&gt;"&lt;?php echo $new_room["defaultslots"] == $i ? ' selected="selected"' : ''; ?&gt;&gt;&lt;?php echo $i; ?&gt;&lt;/option&gt;
                &lt;?php  }  ?&gt;
                &lt;/select&gt;
              &lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;&lt;input type="submit" name="button" value="Add Room and/or Nurse" /&gt;&lt;/td&gt;
            &lt;/tr&gt;
          &lt;/form&gt;
          &lt;tr class="separator"&gt;
            &lt;td colspan="2"&gt;&lt;/td&gt;
          &lt;/tr&gt;
        &lt;/tbody&gt;
      &lt;/table&gt;
    &lt;/div&gt;

    &lt;div id="roomviewer"&gt;
      &lt;?php  if(count($appointment_times) &lt; 1) {  ?&gt;
        &lt;span&gt;There are no times for this appointment, yet. Add some by filling out the form above and clicking "Add Room."&lt;/span&gt;
      &lt;?php  } else {  ?&gt;

        &lt;table class="roomtable"&gt;
          &lt;tr class="center"&gt;
            &lt;td&gt;View Assigned Rooms:&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr class="previousrooms" id="roomlist"&gt;
            &lt;td class="center"&gt;
              &lt;?php  $roomNumber = 1; $lastRoom = null; $currentRoom = null;  ?&gt;
              &lt;?php  foreach($appointment_times as $appointment_time) {  ?&gt;
                &lt;?php  $currentRoom = $appointment_time["room"];  ?&gt;

                &lt;?php  if(is_null($lastRoom) || strtolower($currentRoom) != $lastRoom) {  ?&gt;
                  &lt;input type="button" id="room&lt;?php echo $roomNumber; ?&gt;" onclick="displayRoom(this);" value="&lt;?php echo $currentRoom; ?&gt;" /&gt;
                  &lt;?php  $roomNumber++;  ?&gt;
                &lt;?php  }  ?&gt;

                &lt;?php  $lastRoom = strtolower($currentRoom);  ?&gt;
              &lt;?php  }  ?&gt;
            &lt;/td&gt;
          &lt;/tr&gt;
        &lt;/table&gt;

        &lt;?php  $roomNumber = 1; $lastRoom = null; $currentRoom = null;  ?&gt;

        &lt;?php  $appointmentTimeNumber = 0;  $appointment_times_keys = array_keys($appointment_times); ?&gt;


        &lt;?php  foreach($appointment_times as $appointment_time) {  ?&gt;
          &lt;?php  $currentRoom = $appointment_time["room"];  ?&gt;

          &lt;?php  if(is_null($lastRoom) || strtolower($currentRoom) != $lastRoom) {  ?&gt;
            &lt;form id="selectionform" method="get" onsubmit="return confirmFormSubmit();"&gt;
              &lt;input type="hidden" name="action" value="buttonToActionMapper" /&gt;
              &lt;input type="hidden" name="current_action" value="editAppointment" /&gt;
              &lt;input type="hidden" name="appointmentid" value="&lt;?php echo $appointment["id"]; ?&gt;" /&gt;
              &lt;input type="hidden" name="room" value="&lt;?php echo $currentRoom; ?&gt;" /&gt;
              &lt;div id="view[room&lt;?php echo $roomNumber; ?&gt;]"&gt;
                &lt;table class="roomtable"&gt;
                  &lt;thead&gt;
                    &lt;tr class="roomname"&gt;
                      &lt;td colspan="5"&gt;Room &lt;input type="text" name="newroom" value="&lt;?php echo $currentRoom; ?&gt;" size="7" /&gt;&lt;br /&gt;&lt;input type="submit" name="button" value="Rename Room" /&gt;&lt;/td&gt;
                    &lt;/tr&gt;
                    &lt;tr class="headerrow"&gt;
                      &lt;td&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;/td&gt;
                      &lt;td&gt;Time&lt;/td&gt;
                      &lt;td&gt;User&lt;/td&gt;
                    &lt;/tr&gt;
                  &lt;/thead&gt;
                  &lt;tfoot&gt;
                    &lt;tr&gt;
                      &lt;td colspan="5"&gt;
                      &lt;!--  &lt;input type="button" value="New Time" /&gt;&lt;br /&gt; //--&gt;
                        With Selected:&lt;br /&gt;
                        &lt;select id="selectactionlist" name="selectaction"&gt;
                          &lt;option value="editAppointmentTime"&gt;Edit Time&lt;/option&gt;
                          &lt;option value="deleteAppointmentTimes"&gt;Delete Time(s)&lt;/option&gt;
                        &lt;/select&gt;
                        &lt;input id="selectactionbutton" type="submit" name="button" value="Select" /&gt;
                      &lt;/td&gt;
                    &lt;/tr&gt;
                    &lt;tr&gt;
                      &lt;td colspan="5" class="saveappointment"&gt;
                        &lt;input type="submit" name="button" value="Edit Additional Tests" /&gt;
                        &lt;input type="submit" name="button" value="Delete Room" onclick="return validateDelete('&lt;?php echo $currentRoom; ?&gt;');" /&gt;
                      &lt;/td&gt;
                    &lt;/tr&gt;
                  &lt;/tfoot&gt;
                  &lt;tbody class="bodyview"&gt;

            &lt;?php  $roomNumber++;  ?&gt;
            &lt;?php  $i = 1;  ?&gt;
          &lt;?php  }  ?&gt;


          &lt;tr&gt;
            &lt;td class="countcolumn"&gt;&lt;?php echo $i++; ?&gt;&lt;/td&gt;
            &lt;td class="selectioncolumn"&gt;&lt;input type="checkbox" name="appointmenttimeids[]" value="&lt;?php echo $appointment_time["id"]; ?&gt;" /&gt;&lt;/td&gt;
            &lt;td class="timecolumn"&gt;&lt;?php echo $appointment_time["time"]; ?&gt;&lt;/td&gt;
            &lt;td class="namecolumn"&gt;
              &lt;?php echo  $appointment_time["scheduled"] ? $appointment_time["user"]["fullname"] : '[Empty]' ; ?&gt;
            &lt;/td&gt;
          &lt;/tr&gt;

          &lt;?php 
            $lastRoom = strtolower($currentRoom);
                                    $nextKey = isset($appointment_times_keys[$appointmentTimeNumber + 1]) ?
                                      $appointment_times_keys[$appointmentTimeNumber + 1] : null;
            $nextElement = $nextKey === null ? null : $appointment_times[$nextKey];
            $nextRoom = is_array($nextElement) ? strtolower($nextElement["room"]) : null;
            $appointmentTimeNumber++;
           ?&gt;

          &lt;?php  if($lastRoom != $nextRoom) {  ?&gt;
            &lt;/tbody&gt;
            &lt;/table&gt;
            &lt;/div&gt;
            &lt;/form&gt;
          &lt;?php  }  ?&gt;

        &lt;?php  }  ?&gt;


      &lt;?php  } // End appointment_times count if statement ?&gt;
    &lt;/div&gt;
    &lt;br style="clear: both;" /&gt;

    &lt;form class="altappoptions" method="GET"&gt;
      &lt;input type="hidden" name="action" value="buttonToActionMapper" /&gt;
      &lt;input type="hidden" name="current_action" value="alternateAppOptions" /&gt;
      &lt;input type="hidden" name="appointmentid" value="&lt;?php echo $appointment["id"]; ?&gt;" /&gt;
      &lt;fieldset&gt;
        &lt;legend&gt;Alternate Appointment Options&lt;/legend&gt;
        &lt;input type="submit" name="button" value="Schedule List" /&gt;
        &lt;input type="submit" name="button" value="Show/No Show List" /&gt;
      &lt;/fieldset&gt;
    &lt;/form&gt;

    &lt;form class="backform" method="GET"&gt;
        &lt;input type="hidden" name="action" value="appointmentList" /&gt;
        &lt;input type="submit" value="Back" /&gt;
    &lt;/form&gt;
</code></pre>
