【发布时间】:2011-05-21 15:04:09
【问题描述】:
我正在尝试调试在任何版本的 Internet Explorer 上都不起作用的东西。
代码如下:
<div id="sondage">
<input type="radio" name="reponse" value="oui" id="oui">
<label for="oui">Oui</label>
<input type="radio" name="reponse" value="non" id="non">
<label for="non">Non</label>
</div>
<script type="text/javascript" charset="utf-8">
$(function(){
$('#oui, #non').click(function(){
reponse = $('input[name=reponse]:checked').val();
sondage_id = <?php echo $sondage->id ?>;
$.ajax({
type: "GET",
url: "<?php echo url_for('@sondage_repondre') ?>",
data: "reponse="+reponse+"&id="+sondage_id,
success: function(msg){
resultat = msg.split('|');
if (resultat[0] == "true") {
$('#sondage_message').html("<?php echo __('Merci.') ?>");
} else {
$('#sondage_message').html("<?php echo __('Désolé, vous avez déjà voté pour ce sondage. Merci.') ?>");
}
$('#sondage').html(resultat[1]);
}
});
});
});
</script>
错误发生在该行 (reponse = $('input[name=reponse]:checked').val();)。
你知道发生了什么吗?
谢谢!
编辑:如问:错误是:
Line 511, Char 7, Object doesn't support this property or method.
这是完整的输出:http://pastie.org/1355610
再次感谢!
【问题讨论】:
-
你确定那是导致错误的行吗?我不相信 IE 的行号,但您可以通过硬编码该值来验证它,看看它是否有效。你得到什么错误?您能否使用呈现的代码(“查看源代码”)而不是实际源代码来更新您的问题?
<? php echo不是 IE 所看到的,所以这对我们没有多大帮助。例如,如果$sondage->id产生一个字符串或一个空值,这将在任何浏览器上中断。 -
你完全正确,我更新了问题。谢谢:)
-
您从 IE 得到的错误信息是什么?
-
第 511 行,字符 7,对象不支持此属性或方法。
标签: javascript jquery internet-explorer jquery-selectors