| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 437 人关注过本帖
标题:路的方向
只看楼主 加入收藏
yql100059
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2010-6-13
结帖率:0
收藏
 问题点数:0 回复次数:4 
路的方向
<html>
<head><title></title>
<script language="vbscript">
<!--
sub checkvl()
dim e
e=bb.e.value
if e=""then
msgbox"........",0+48
focusto(0)
exit sub
else
document.bb.submit()
end if
end sub
sub focusto(x)
document.bb.elements(x).focusto()
end sub
-->
</script>
</head>
<body>
<form method="post" action="a.asp"name="bb">
<input name="e" type="checkbox"value="c">c
<input name="e" type="checkbox"value=d">d
<input name="e" type="checkbox"value="f">f
<input type="button" name="but1"value="提交" onclick="checkvl()">
<input type="reset"name="but2"value="取消">
</body>
</html>
小弟初来驾到,才学ASP,上面有个表单,想在点击提交按扭时对表单的内容进行验证,对复选框的验证,在多个选项中必须最少选择一个,必须对复选框进行选择。小弟先在这谢谢大家!~~   请用VB脚本
搜索更多相关主题的帖子: 路的方 
2010-06-13 17:13
icecool
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:20
帖 子:1214
专家分:1366
注 册:2005-3-14
收藏
得分:0 


<html>
<head><title></title>
<script language="javascript">
<!--
function checkvl()
{
   var tem=0;
   for(var i=0;i<3;i++)
   {
       if(document.bb.e[i].checked)
          {
          tem=tem+1;

          }
   }
   if(tem<1){
            alert("至少选择一项!");
            return false;

             }
            document.bb.submit();
}
</script>
</head>
<body>
<form method="post" action="a.asp" name="bb">
<input name="e" type="checkbox" value="c">c
<input name="e" type="checkbox" value="d">d
<input name="e" type="checkbox" value="f">f
<input type="button" name="but1" value="提交" onclick="checkvl();">
<input type="reset" name="but2" value="取消">
</form>
</body>
</html>

不好意思,没看到要用VBS...

[ 本帖最后由 icecool 于 2010-6-14 09:05 编辑 ]

http://toorup.3v.do
loading...
2010-06-14 01:17
icecool
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:20
帖 子:1214
专家分:1366
注 册:2005-3-14
收藏
得分:0 
<script language="vbscript">
function checkvl()
tem=0
for i=0 to 2
     if document.forms("bb").e(i).checked then
        tem=tem+1
     end if
next
     if tem<1 then
        msgbox "至少选择一项"
        exit function
     else
        document.bb.submit()
     end if
end function
</script>

<html>
<head><title></title>
</head>
<body>
<form method="post" action="a.asp" name="bb">
<input name="e" type="checkbox" value="c">c
<input name="e" type="checkbox" value="d">d
<input name="e" type="checkbox" value="f">f
<input type="button" name="but1" value="提交" onclick="checkvl()" >
<input type="reset" name="but2" value="取消">
</form>
</body>
</html>

[ 本帖最后由 icecool 于 2010-6-14 13:46 编辑 ]

http://toorup.3v.do
loading...
2010-06-14 08:56
yql100059
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2010-6-13
收藏
得分:0 
谢谢你呀!大哥 !~~~你设计的语句我看了,也能运行的起。也大概明白了你没个语句所表达的意思!你能不能看出我刚刚上面的那个语句在运行的时候是那里出错,获取不到VALUE值。
2010-06-14 11:34
icecool
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:20
帖 子:1214
专家分:1366
注 册:2005-3-14
收藏
得分:0 
value的值这样可以获得:document.forms("bb").e(i).value

你那语句因逻辑上有问题,不管你选中没有,VALUE的值都是存的不可能为空。

http://toorup.3v.do
loading...
2010-06-14 12:40
快速回复:路的方向
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.022904 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved