JS获取选中的Listbox的值 这个LISTBOX不是多选的,就是一个普通的单选的请问各位乡亲父老,给点代码,JS怎么获取listbox选中的值 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 document.getElementById('select1').value <asp:ListBox ID="ListBox1" runat="server" Width="131px" onclick="javascript:alert(document.getElementById(this.id).value)"> <asp:ListItem>1</asp:ListItem> <asp:ListItem>2</asp:ListItem> <asp:ListItem>3</asp:ListItem> </asp:ListBox> var list = document.getElementById("listboxid"); for(var i=0;i<list.options.length;i++) { if(list.options[i].selected) { alert( list.options[i].value); } }试下 获取选中文本\var obj = document.getElementById('select1')for(var i= 0;i<obj.options.length;i++){ if(obj.selected){alert(option.text);break};} var selectElement = document.getElementById("select1");var value1 = selectElement.options[selectElement.selectedIndex].value; 我怎么判断LISTBOX没有被选中? var list = document.getElementById("listboxid");if(list.options.length==0){} var selectElement = document.getElementById("select1"); 判断selectElement.selectedIndex>=0就可以了,如果没选中的话,他的值为-1 直接document.getElementById('select1').value就可以了判断是否为空 asp.net自动发送邮件!! 实在没办法了 生成xml问题 跪求答案 关键字不在字典中 .net面试常问问题 公司急招net开发人员 怎么把float f=123.05763 转换成 string s=123.05 我在IIS中添加了个虚拟目录怎么在IIS中看不见?急啊老大帮忙 ************100分求多个DataTable联合显示的问题!Up有份!!**************** 怎么不能using Excel 如何得到TreeNode的全路径名??? 用javascript生成层。层怎显示在窗口右下角,求助!!! repeater分页问题!!!!!!!!急
<asp:ListBox ID="ListBox1" runat="server" Width="131px" onclick="javascript:alert(document.getElementById(this.id).value)">
<asp:ListItem>1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
</asp:ListBox>
for(var i=0;i<list.options.length;i++)
{
if(list.options[i].selected)
{
alert( list.options[i].value);
}
}试下
var obj = document.getElementById('select1')
for(var i= 0;i<obj.options.length;i++)
{
if(obj.selected){alert(option.text);break};
}
var value1 = selectElement.options[selectElement.selectedIndex].value;
if(list.options.length==0){
}
判断是否为空