判断第几个选中
if ('${da1}' == 1) {
document.forms[0].selZqda.options[1].selected = true;
}
if ('${da2}' == 2) {
document.forms[0].selZqda.options[2].selected = true;
}
自动添加值
function ajaxArea(){
id=document.getElementById("jhd0").value;
if(id ==""){
document.getElementById("deliverArea").options.length = 0;
document.getElementById("deliverArea").options.add(new Option("请选择",""));
}else{
document.getElementById("deliverArea").options.length = 0;
buffalo.remoteCall("springMarketConditionAjax.getArea",[id,],function(reply){
ret = reply.getResult();
for(var a=0;a<ret.length;a++){
document.getElementById("deliverArea").options.add(new Option(ret[a].areaName,ret[a].areaName));
}
});
}
}
![](https://img2024.cnblogs.com/blog/35695/202408/35695-20240826070647288-243310440.jpg)