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