本文主要分享了利用js给DropdownList赋值的实例,代码清晰,图文并茂,有利于理解与掌握,需要的朋友可以看下
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>
更多关于利用js给DropdownList赋值实例请关注PHP中文网(www.php.cn)其它文章!