动态的为select赋值


//函数
function initExtend(_this){
var typeId = _this.value;
$.post("${base}/console/initExtend.jspx", {
typeId : typeId
}, function(data) {
var _option ='';
var temp = eval("("+data+")");
for(var i=0;i<temp.length;i++){
_option = $("<option>").text(temp[i].NAME).val(temp[i].ID)
$("#extendid").append(_option);
}
});
}

//级联动态赋值给下拉框
<td>
<select name="typeid" onchange="initExtend(this);" style='width:110px;'>
<option value="">请选择</option>
<#if knowledgeTypelist??>
<#list knowledgeTypelist as k>
<option value="<@c.property value=k.id/>"><@c.property value=k.name/></option>
</#list>
</#if>
</select>
</td>

//赋值的下拉框
<td>
<select name="extendid" id="extendid" style='width:110px;'>
<option value="">请选择</option>
</select>
</td>

你可能感兴趣的:(C++,c,C#)