利用js给DropdownList赋值实例
程序员文章站
2022-07-03 19:58:46
话不多说,请看下面代码
var row = [{ "code": "1", "model": "apollo" }, { "code": "2", "model"...
话不多说,请看下面代码
var row = [{ "code": "1", "model": "apollo" }, { "code": "2", "model": "apollo m/b1"}]; for (var i = 0; i < row.length; i++) { var addoption = document.createelement("option"); addoption.text = row[i]["model"]; addoption.value = row[i]["model"]; document.getelementbyid("ddlmodel").add(addoption); }
<asp:dropdownlist id="ddlmodel" name="ddlmodel" runat="server" font-size="9pt" width="105px" cssclass="dropdownlist"> </asp:dropdownlist>
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,如果有疑问大家可以留言交流,同时也希望多多支持!