日期:2014-05-17  浏览次数:20496 次

asp。 下拉框下拉框下拉框下拉框下拉框下拉框下拉框
alert("测试")  
 var aa=document.getElementById("DropDownList1").value;
     
        alert(aa);


---------------------
       <asp:DropDownList ID="DropDownList1" runat="server" style="height: 22px">
            <asp:ListItem Value="1009">--请选择--</asp:ListItem>              
            <asp:ListItem Value="10215">开启提醒</asp:ListItem>
            <asp:ListItem Value="10216">关闭提醒</asp:ListItem>
        </asp:DropDownList>
可以弹出“测试”的框
为什么第二句会报错,提示 缺少对象。  
asp

------解决方案--------------------
lz 在运行后的页面里  通过 查看 该网页的源代码   看看 该控件的实际id是什么 
------解决方案--------------------
alert("测试");
var aa=document.getElementById("DropDownList1").value;
alert(aa);

第一句少个;号, 亲
------解决方案--------------------
 var aa = document.getElementById('<%= DropDownList1.ClientID %>').value;
------解决方案--------------------
var aa=document.getElementById("DropDownList1").value;


---------------------

这一句脚本应该写在DDL的下面,才能找到对象
------解决方案--------------------

------解决方案--------------------
接分