请问如何用javascript绑定asp.net中的dropdownlist控件?如 var oTable = document.getElementById("_SaleRentable_Table");
var oInput = document.getElementById("SaleRentable");
oTable.removeChild(oTable.firstChild); // 清除下拉框备选项 // 循环插入项
var oTr;
var oTd; //重置下拉框状态
oInput.reset();
switch (node)
{
case "0":
oTr = oTable.insertRow();
oTd = oTr.insertCell();
oTd.val = "出售";
oTd.innerText = "出售";
oTr = oTable.insertRow();
oTd = oTr.insertCell();
oTd.val = "出租";
oTd.innerText = "出租";
oTr = oTable.insertRow();
oTd = oTr.insertCell();
oTd.val = "租售";
oTd.innerText = "租售";
break;
case "1":
oTr = oTable.insertRow();
oTd = oTr.insertCell();
oTd.val = "出租";
oTd.innerText = "出租";
oTr = oTable.insertRow();
oTd = oTr.insertCell();
oTd.val = "租售";
oTd.innerText = "租售";
break;
case "2":
oTr = oTable.insertRow();
oTd = oTr.insertCell();
oTd.val = "出售";
oTd.innerText = "出售";
oTr = oTable.insertRow();
oTd = oTr.insertCell();
oTd.val = "租售";
oTd.innerText = "租售";
break;
case "12":
oTr = oTable.insertRow();
oTd = oTr.insertCell();
oTd.val = "租售";
oTd.innerText = "租售";
break;
}
}
可这是xml配合做出的,我想将这些绑定到dropdownlist,怎么绑定呢?
var oInput = document.getElementById("SaleRentable");
oTable.removeChild(oTable.firstChild); // 清除下拉框备选项 // 循环插入项
var oTr;
var oTd; //重置下拉框状态
oInput.reset();
switch (node)
{
case "0":
oTr = oTable.insertRow();
oTd = oTr.insertCell();
oTd.val = "出售";
oTd.innerText = "出售";
oTr = oTable.insertRow();
oTd = oTr.insertCell();
oTd.val = "出租";
oTd.innerText = "出租";
oTr = oTable.insertRow();
oTd = oTr.insertCell();
oTd.val = "租售";
oTd.innerText = "租售";
break;
case "1":
oTr = oTable.insertRow();
oTd = oTr.insertCell();
oTd.val = "出租";
oTd.innerText = "出租";
oTr = oTable.insertRow();
oTd = oTr.insertCell();
oTd.val = "租售";
oTd.innerText = "租售";
break;
case "2":
oTr = oTable.insertRow();
oTd = oTr.insertCell();
oTd.val = "出售";
oTd.innerText = "出售";
oTr = oTable.insertRow();
oTd = oTr.insertCell();
oTd.val = "租售";
oTd.innerText = "租售";
break;
case "12":
oTr = oTable.insertRow();
oTd = oTr.insertCell();
oTd.val = "租售";
oTd.innerText = "租售";
break;
}
}
可这是xml配合做出的,我想将这些绑定到dropdownlist,怎么绑定呢?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货