JS填充下拉列表

function setPrcCode(){

var pageCode = kysz.$("app.ccas.base.processNodeAuth.add.form.pageCode").value;

//选中"请选择",清空下拉列表

if(null==pageCode||""==pageCode){

var prcCode = skysz.$("app.ccas.base.processNodeAuth.add.form.prcCode");

removeAll(prcCode);

grid.clearAndLoadpage("");

return ;

}

var prcCode = skysz.$("app.ccas.base.processNodeAuth.add.form.prcCode");

removeAll(prcCode);

var oSelect = document.createElement("OPTION");

oSelect.value = "";

oSelect.text = "请选择";

prcCode.options.add(oSelect);

var obj = skysz.ajax.postSync("${findPrcCode}","pageCode=" + pageCode).object;

if(typeof obj=='undefined'){

return;

}

for(var i = 0;i < obj.length;i++){

var oOption = document.createElement("OPTION");

oOption.value = obj[i][0];

oOption.text = obj[i][1];

prcCode.options.add(oOption);

}

}

function removeAll(prcCode){

for(var j = 0; j < prcCode.options.length;){

prcCode.removeChild(prcCode.options[0]);

}

}

你可能感兴趣的:(下拉列表)