checkboxlist 选择为空时的判断(customvalidator[用户自定义验证控件]的应用):
来源:互联网 发布:手机淘宝怎么查积分 编辑:程序博客网 时间:2024/05/19 01:13
checkboxlist 选择为空时的判断(customvalidator[用户自定义验证控件]的应用):
<script language="javascript" type="text/javascript">
function check(source,args)
{
var obj=document.getElementById('<%=this.huanjing.ID%>');//返回具有和属性id的值相同或相似的对象集合
var k,bol=false;
var ln=(obj.all.tags('input').length);//返回obj对象里具有“input”标签对象的集合
for(k=0;k<ln;k++)
{
//alert(" name:"+obj.all.tags('input')[k].name+"是否:"+obj.all.tags('input')[k].checked);
if(obj.all.tags('input')[k].checked) // obj对象里具有input标签对象键值为k的属性为checked的值
bol=bol||true;
}
if(bol)
args.IsValid=true;
else
args.IsValid=false;
}
</script>
<asp:checkboxlist id="huanjing" runat="server" Height="36px" Width="400px" RepeatDirection="Horizontal">
<asp:ListItem Value="Win98">Win98</asp:ListItem>
<asp:ListItem Value="WinMe">WinMe</asp:ListItem>
<asp:ListItem Value="WinXP">WinXP</asp:ListItem>
<asp:ListItem Value="Win2000">Win2000</asp:ListItem>
<asp:ListItem Value="Win2003">Win2003</asp:ListItem>
<asp:ListItem Value="Unit">Unit</asp:ListItem>
</asp:checkboxlist><asp:customvalidator id="CustomValidator1" runat="server"
ErrorMessage="运行环境没有选择,请选择运行环境" ClientValidationFunction="check"></asp:customvalidator>
<script language="javascript" type="text/javascript">
function check(source,args)
{
var obj=document.getElementById('<%=this.huanjing.ID%>');//返回具有和属性id的值相同或相似的对象集合
var k,bol=false;
var ln=(obj.all.tags('input').length);//返回obj对象里具有“input”标签对象的集合
for(k=0;k<ln;k++)
{
//alert(" name:"+obj.all.tags('input')[k].name+"是否:"+obj.all.tags('input')[k].checked);
if(obj.all.tags('input')[k].checked) // obj对象里具有input标签对象键值为k的属性为checked的值
bol=bol||true;
}
if(bol)
args.IsValid=true;
else
args.IsValid=false;
}
</script>
<asp:checkboxlist id="huanjing" runat="server" Height="36px" Width="400px" RepeatDirection="Horizontal">
<asp:ListItem Value="Win98">Win98</asp:ListItem>
<asp:ListItem Value="WinMe">WinMe</asp:ListItem>
<asp:ListItem Value="WinXP">WinXP</asp:ListItem>
<asp:ListItem Value="Win2000">Win2000</asp:ListItem>
<asp:ListItem Value="Win2003">Win2003</asp:ListItem>
<asp:ListItem Value="Unit">Unit</asp:ListItem>
</asp:checkboxlist><asp:customvalidator id="CustomValidator1" runat="server"
ErrorMessage="运行环境没有选择,请选择运行环境" ClientValidationFunction="check"></asp:customvalidator>
- checkboxlist 选择为空时的判断(customvalidator[用户自定义验证控件]的应用)
- checkboxlist 选择为空时的判断(customvalidator[用户自定义验证控件]的应用):
- CustomValidator自定义验证控件
- CustomValidator验证控件 的使用方法
- CustomValidator验证控件 的使用方法
- 自定义判断控件customvalidator
- 自定义验证控件 customvalidator的使用小例
- Asp.net自定义验证控件CustomValidator 的使用方法
- CustomValidator自定义控件的使用
- ASP.NET CustomValidator自定义验证是否为空
- 自定义客户端验证控件 CustomValidator
- CustomValidator自定义检测控件的使用
- 关于验证CheckBoxList非空的方法
- CustomValidator控件的使用
- CustomValidator控件的使用
- customvalidator控件的使用
- 用户自定义控件的应用。
- 用户自定义控件的应用
- javascript 动态添加表格行
- 程序员如何应对裁员风暴
- js 获取 table 某一单元格
- js获得select的选定项的text属性和value属性(二种方法)
- div托动+动态生成div
- checkboxlist 选择为空时的判断(customvalidator[用户自定义验证控件]的应用):
- dropdownlist未选择时的判断:
- 第一次审稿的感觉
- Linux Shell
- ASP.NET如何存取SQL Server数据库图片
- ASP.NET图片验证码的实现
- .net验证码的做法
- Xpath简单用法(双语)
- 究竟哪一种脚本语言更有发展前途呢?