2012-03-14 77 views
0

我对Internet Explorer有这个烦人的问题。 首先是一些代码,所以它会更容易解释。单选按钮值浏览器

<input type="radio" name="rdo_keuze" id="keuze_1" value="1">keuze1</input> 
<input type="radio" name="sub_rdo_keuze" id="keuze_2" value="2">keuze2</input> 
<input type="radio" name="sub_rdo_keuze" id="keuze_3" value="3">keuze3</input> 
<input type="radio" name="sub_rdo_keuze" id="keuze_4" value="4">keuze4</input> 
<input type="radio" name="rdo_keuze" id="keuze_5" value="5">keuze5</input> 
<input type="radio" name="rdo_keuze" id="keuze_6" value="6">keuze6</input> 
<input type="radio" name="rdo_keuze" id="keuze_7" value="7">keuze7</input> 

所以sub_rdo_keuze是rdo_keuze的子集。当我检查例如keuze_3时,我的页面正在发送到另一个URL。当我回到那个页面时,我的rdo_keuze仍然被选中,并且我的sub_rdo_keuze被正确检查。但是,有一个div在keuze_3时不应显示。当我提醒我的单选按钮时,他似乎没有读取sub_rdo_keuze值。 (但在Firefox我没有得到这个问题) 这里是我的javascript的一部分:

$(document).ready(function(){ 
$('input:radio:').click(function(){showdivs(this.value);});}); 
    if($('input:radio:checked').val() == 1 && $('input[name=sub_rdo_keuze]:checked').val() != undefined){ 
     showdivs($('input[name=sub_rdo_keuze]:checked').val()); 
     }else{ 
      showdivs($('input:radio:checked').val()); 
     } 

function showdivs(obj){ 

首先我想,也许是因为我的网页没有完全加载,所以我尝试window.load, window.ready,但他们都没有工作。所以有人有一个想法我可以做错了什么?

刚刚注意到了一些不同:当我回到页面时,他首先选择了1选项,但速度非常快,他会改变为正确的值。只有他才提醒1选择。 非常感谢你提前!

回答

0

我找到了一个解决方案,但它并不完美。我只是将子单选按钮重命名为父母,并为其添加了一个类。这样他阅读价值观。