0
我有以下代码。Javascript选择不更新
function validateStatuses(bill_id){
var bill = bills[bill_id];
var selects = $('#bill_'+bill.bill_id+' .status_select');
var codes = $('#bill_'+bill.bill_id+' .status_code');
var value = null;
for (var i = 0; i < selects.length; i++) {
//value = document.getElementById('#Item_'+Item.item_id+'statuses'+codes).value;
value = selects[i].options[selects[i].selectedIndex].value;
if (value == 'new'){
for (var j = 0; j < codes.length; j++) {
var blagh = codes[j].options[codes[j].selectedIndex].text;
if(value == 'new' && blagh == "none"){
//A status exist of NEW with a status code of NONE this is not acceptable
$('#info_dialog').html('');
$('#info_dialog').append("<p>You are trying to process an object with a View of NEW and a This CODE of NONE. Please correct this issue before you proceed!</p><hr />");
$('#info_dialog').dialog({
buttons:{
Cancel: function(){
$(this).dialog('close');
}
}
});
return false;
}//end if
}//end for
}else{
}//end if
}//end for
return true;
}//end function
我想只有当值的条件==“新” & & blagh ==“无”遇到了错误显示。如果变量值已经被设置为除new以外的值,这将起作用。但是,如果变量是新的,并且我不更改所选的blagh索引,则条件仍然失败。 只有当value == new时更改value和blagh的值时才会接受该条件。该函数从onCLick事件运行,我认为这会强制值变量更新为新的选定索引。我在这里错过了什么?有什么建议么?
是的,这是非常多的。 – 2012-01-12 15:52:33