2013-05-01 52 views
0

得到遏制,我需要找到如何将这一问题与IE8输入不IE8

整理出一个办法,我有我的行和列

<table> 
    <thead> 
     <tr class="body"> 
      <th class="checkbox"><input class="forecast first" name="1" type="checkbox"></th> 
      <th class="checkbox"><input class="forecast second" name="2" type="checkbox"></th> 
      <th class="checkbox"><input class="forecast third" name="3" type="checkbox"></th> 
      <th class="checkbox"><input class="forecast any" name="any" type="checkbox"></th> 
     </tr> 
    </thead> 
     <tbody> 
     <tr class="body"> 
      <td class="checkbox"><input class="forecast first" name="1" type="checkbox"></td> 
      <td class="checkbox"><input class="forecast second" name="2" type="checkbox"></td> 
      <td class="checkbox"><input class="forecast third" name="3" type="checkbox"></td> 
      <td class="checkbox"><input class="forecast any" name="any" type="checkbox"></td> 
     </tr> 
     <tr class="body"> 
      <td class="checkbox"><input class="forecast first" name="1" type="checkbox"></td> 
      <td class="checkbox"><input class="forecast second" name="2" type="checkbox"></td> 
      <td class="checkbox"><input class="forecast third" name="3" type="checkbox"></td> 
      <td class="checkbox"><input class="forecast any" name="any" type="checkbox"></td> 
     </tr> 
     </tbody> 
</table> 

在我的列有一个表是与以下的组合工作,我的输入复选框:

oncheck: function(checkbox) { 
    if ($(checkbox).prop("checked")) { // checking 
     if ($(checkbox).hasClass('first')) { 
     $('.forecast[value="' + checkbox.value +'"]').prop("checked", false); // unmarking checkboxes in this row 
     $('.forecast.first').prop("checked", false);       // unmarking checkboxes in this column 
     $('.forecast.any').prop("checked", false);       // unmarking checkboxes in Any order column 
     $(checkbox).prop("checked", true); 
     } 
     if ($(checkbox).hasClass('second')) { 
     if ($('.forecast.first[value!="' + checkbox.value + '"]:checked').length > 0) { 
      $('.forecast.second').prop("checked", false);         // unmarking checkboxes in this column 
      $('.forecast.third[value="' + checkbox.value +'"]').prop("checked", false); // unmarking 3rd checkboxes in this row 
      $(checkbox).prop("checked", true); 
     } else { 
      $(checkbox).prop("checked", false); 
     } 
     } 
     if ($(checkbox).hasClass('third')) { 
     if ($('.forecast.first[value!="' + checkbox.value + '"]:checked').length > 0 && 
      $('.forecast.second[value!="' + checkbox.value + '"]:checked').length > 0) { 
      $('.forecast.third').prop("checked", false); // unmarking checkboxes in this column 
      $(checkbox).prop("checked", true); 
     } else { 
      $(checkbox).prop("checked", false); 
     } 
     } 
     if ($(checkbox).hasClass('any')) { 
     // unmarking checkboxes in columns : 1st 2nd 3rd 
     $('.forecast.first').prop("checked", false); 
     $('.forecast.second').prop("checked", false); 
     $('.forecast.third').prop("checked", false); 
     $(checkbox).prop("checked", true); 
     } 
    } 
    else { 
     if ($(checkbox).hasClass('first')) { 
     $('.forecast').prop("checked", false); // unchecking all 
     } 
     if ($(checkbox).hasClass('second')) { 
     $('.forecast.third').prop("checked", false); // unchecking all third class 
     } 
    } 
    } 
}; 

这意味着基本上是:

  • 在第二列中的输入可以当在 输入端的第一列进行检查只检查,并且在第三列中的输入可为 只有当在第二列中的输入进行检查

  • 检查

    所有输入不能在同一行中进行检查,但只用于行输入

  • 当检查输入的任何,所有其他投入得到选中

在IE8中,任何浏览器(Safari,Chrome和IE 10和9)都可以正常运行,其中一部分为,我无法检查我的第一个输入

显然问题来自脚本,我需要一些关于如何解决它的技巧。

只是为了更多的信息,而不是prop我使用attr它并没有在IE中工作。

所有的建议,我想,也许我可以破解了一些JS只是IE8

+0

您可能正在使用旧版IE(IE 6,7和8)中不支持的jQuery 2.0.0。请确认一次。 – 2013-05-01 07:01:36

+0

没有jquery版本是1.9.2..is支持? – Koala7 2013-05-01 08:02:47

+0

不需要,它应该可以工作。我来检查一下。 – 2013-05-01 09:08:23

回答

0

你可以替换以下行:

if ($(checkbox).prop("checked")) { 

这一个?

if ($(checkbox).is(":checked")) { 
+0

感谢您的提示,我已经尝试过,但它不起作用:( – Koala7 2013-05-01 09:01:42

+0

你会得到任何错误或功能不被执行? – 2013-05-01 09:02:39

+0

它只是不执行,没有任何改变,它仍然适用于任何浏览器的一部分从ie8 – Koala7 2013-05-01 09:10:04