0
我们正在构建一个web应用程序,它在'select'标签上使用了jquery ajax和jsp。 Ajax请求适用于所有浏览器,当然,除了臭名昭着的IE系列以外。通常,如果我点击一个'select'标签,它应该根据选择的选项动态填充其他'select'标签。 但在IE中,此功能第一次工作,然后第二次停止工作。然后,当我第三次点击另一个'选择'标签时,一切正常。 这是第二次让我担心。jquery ajax在IE中无法正常工作
这里是jQuery的AJAX代码,它适用于所有的电平变化的所有事件“中选择”标签:
function updateAvailableAttributes() {
var form = document.forms["orderDefinition"];
form.elements["formChangeRequest"].value = "true";
$.ajax({
type: "POST",
cache: false,
dataType: "html",
url: "ajax/possibleValues.html",
data: $("form#orderDefinition").serialize(),
success: function(response){
$('#usercontent .sleeve .toprow').html(response);
//alert("Ajax is working!");
applyValidation();
radioButtonHighlightSelection();
},
error: function(response, ioArgs, err) {
if (response.status == 601) {
sessionTimedOut();
}
}
});
// Display a "please wait" message
$("#waitingMsgOverlay, #waitingMsgBox, #waitingMsg, #waitingMsgParag").ajaxStart(function(e){
var map = document.getElementById("OrderMap");
map.disableApplication();
$(this).show();
}).ajaxStop(function(e){
var map = document.getElementById("OrderMap");
map.enableApplication();
$(this).hide();
$("#toolpanel").height($("#orderMap").height());
});
}
请咨询我关于这个,它变得讨厌。
这里的 'radiaButtonHighlightSelection()' 代码:
function radioButtonHighlightSelection()
{
var radioBtnCollection = $("#orderDefinition input:radio");
var radioBtnCheckedCollection = $("#orderDefinition input:radio:checked");
var checkBoxCollection = $(".fixedPricedAreasHolder input:checkbox");
var checkBoxCheckedCollection = $(".fixedPricedAreasHolder input:checkbox:checked");
radioBtnCollection.each(function(i, elemRd)
{
if(elemRd.checked)
{
$(this).parent().addClass("selectedRadioBg");
$(this).parent().next(".fixedPricedAreasHolder").addClass("selectedCheckboxBg");
}
else
{
$(this).parent().removeClass("selectedRadioBg");
}
checkBoxCollection.each(function(i, cb)
{
if(cb.checked)
{
if($("#orderDefinition input:radio:eq(0)")[0].checked){
$("#orderDefinition input:radio:eq(0)").removeAttr("checked");
$(this).parent().parent().prev().find("input:radio").attr({"checked": "checked"});
$(elemRd).parent().removeClass("selectedRadioBg");
$(this).parent().parent().prev().addClass("selectedRadioBg");
$(this).parent().parent().addClass("selectedCheckboxBg");
}
else if(cb.checked == false){
$("#orderDefinition input:radio:eq(0)").attr({checked: "checked"});
$("#orderDefinition input:radio:eq(1)").attr({checked: "checked"});
}
}
});
});
}
在此先感谢。
我已经按要求在我的问题中添加了'radioButtonHighlightSelection()'代码,但我不确定它是否是罪魁祸首。 – Shaoz 2010-09-23 09:11:43