概述
[b]判断第几个选中[/b]
if ('${da1}' == 1) {
document.forms[0].selZqda.options[1].selected = true;
}
if ('${da2}' == 2) {
document.forms[0].selZqda.options[2].selected = true;
}
[b]自动添加值[/b]
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));
}
});
}
}
最后
以上就是如意蜗牛为你收集整理的js控制options的几个选中和自动添加options值的全部内容,希望文章能够帮你解决js控制options的几个选中和自动添加options值所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复