option 选不中问题

时间:2024-01-14 22:27:44

function appAndBuz(appName,buzName,areaCenterCode){
//appName,buzName下拉框的值start
$.ajax({
type: "POST",
url: "<%=basePath%>/logs/queryLogAppAndBuz.action",
dataType : "json",
success : function(data0) {
var listAppNameSt = data0.listAppNameSt;
var listbuzNameSt = data0.listBuzNameSt;
var listAreaCenterCodeSt = data0.listAreaCenterCodeSt;
var htmlAppName = "";
if (listAppNameSt.length > 0) {
for (var int = 0; int < listAppNameSt.length; int++) {
var name = listAppNameSt[int];
if(appName==name){
htmlAppName += "<option selected='selected' value="+name+">"+name+"</option>";
}else{
htmlAppName += "<option value="+name+">"+name+"</option>";
}
}
$("#appName").html(htmlAppName);
}
var htmlBuzName = "";
if (listbuzNameSt.length > 0) {
for (var int = 0; int < listbuzNameSt.length; int++) {
var name = listbuzNameSt[int];
if(buzName==name){
htmlBuzName += "<option selected='selected' value="+name+">"+name+"</option>";
}else{
htmlBuzName += "<option value="+name+">"+name+"</option>";
}
}
$("#buzName").html(htmlBuzName);
}
var areaCenterCodeHtml = "";
if (listAreaCenterCodeSt.length > 0) {
for (var int = 0; int < listAreaCenterCodeSt.length; int++) {
var name = listAreaCenterCodeSt[int];
if(areaCenterCode==name){
areaCenterCodeHtml += "<option selected='selected' value="+name+">"+name+"</option>";
}else{
areaCenterCodeHtml += "<option value="+name+">"+name+"</option>";
}
}
$("#areaCenterCode").html(areaCenterCodeHtml);
}
}
});
//appName,buzName下拉框的值end
}