如何在客户端判断一个下拉框选择是否为空.........
<asp:DropDownList id="dropdownlist" runat="server">
<asp:ListItem value="0" Text=""/>
<asp:ListItem value="1" Text="A"/>
<asp:ListItem value="2" Text="B"/>
<asp:ListItem value="3" Text="C"/>
</asp:DropDownList>
我的问题是如何在客户端判断....
我着么写的。
<script>
function check()
if(document.Form1.dropdownlist.SelectedItem.value=="0")
{
return false;
}
</script>
不起什么做用不知道该怎么写......
<asp:DropDownList id="dropdownlist" runat="server">
<asp:ListItem value="0" Text=""/>
<asp:ListItem value="1" Text="A"/>
<asp:ListItem value="2" Text="B"/>
<asp:ListItem value="3" Text="C"/>
</asp:DropDownList>
我的问题是如何在客户端判断....
我着么写的。
<script>
function check()
if(document.Form1.dropdownlist.SelectedItem.value=="0")
{
return false;
}
</script>
不起什么做用不知道该怎么写......
解决方案 »
- 为什么vs2008中debug的时候,int型的参数都以16进制形式显示出来,
- 菲票打印格式设置
- 怎样在BulletedList的click事件里改写被点击项的html标签
- 如何在用户关闭窗口时,执行一数据库操作啊。请大虾指教啊!!
- 我遇到的最难回答的两个问题
- 又有分抢了!
- 关于DropDownList控件的问题 急~~~~~~~~~~~~
- 编译DLL文件的话其实应该说编译一个命名空间吧?还是编译一个类?
- 笨笨蜗牛大哥接分啦。谢谢帮我解答问题。斑主勿删!
- 都来看看,要不会死人的!
- 关于NET Framework
- asp.net的界面在VS.NET里面做不方便.但是用DW作好怎么在VS.NET里面写程序部分亚?救命!
试试看,没测试过的。
<script>
function check()
if(document.Form1.ddlSectors.options[document.Form1.ddlSectors.selectedIndex].value=="0")
{
return false;
}
</script>
<script>
function check()
if(document.Form1.dropdownlist.options[document.Form1.dropdownlist.selectedIndex].value=="0")
{
return false;
}
</script>
var obj = document.getElementById("DropDownList1");
if (obj.options.length == 0)
{
//空
}
</script>
{
alert("选的是0");
return false;
}
else
{
alert("选的不是0");
}</script>//注意在客户端的写法:document.all.dropdownlist.value
this.DropDownList1.Attributes.Add("onchange","return check()");