| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 459 人关注过本帖
标题:为什么<script>代码不能用啊?
只看楼主 加入收藏
tcnxm23
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2011-10-16
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:2 
为什么<script>代码不能用啊?
****************************
<script language="vbscript">
<!--
sub tijiao_onclick()
if len(login.userid.value)<3 then
    msgbox "用户名太短,请选择一个长度大于三个字符的名字"
    login.userid.select
    exit sub
end if                                                                 

if instr(trim(login.userid.value)," ")>1 then
    msgbox "用户名中不能含有空格"
    login.userid.select
    exit sub
if len(login.userpw.value)<4 then
    msgbox "密码太短,请选择一个长度大于4的密码"
    login.userpw.select
    exit sub
if login.userpw.value<>login.verifypw.value then
    msgbox"两次输入的密码不相同"
    login.userpw.value=""
    login.verifypw.value=""
    login.userpw.select
    exit sub
end if
if login.name.value=""then
    msgbox"为了为您提供更好地服务请输入名字"
    login.name.select
    exit sub
end if
if login.idnumber.value="" or Not isnumeric(login.idnumber.value) or
len(login.idnumber.value)<>15 and len(login.idnumber.value)<>18 then
    msgbox"请输入正确的身份证号码"
    login.idnumber.select
    exit sub
end if
if login.age.value="" or Not isnumeric(login.age.value) then
    msgbox "请输入你得年龄"
    login.age.select
    exit sub
else
    if cint(login.age.value)<12 then
    msgbox"年龄输入范围有误"
    login.age.select
    exit sub
end if
if login.address.value=""then
    msgbox"请输入您的详细地址"
    login.address.select
    exit sub
end if
if len(login.zipcode.value)<>6 or Not isnumeric(login.zipcode.value) then
    msgbox "邮政编码有误,请更正"
    login.zipcode.select
    exit sub
end if

  if not login.phone.value=""then
    if isnumeric(login.phone.value)<8 or left(login.phone.value,1)="1" or
    left(login.phone.value,1)="+" then
    msgbox"电话号码有误"
    login.phone.select
    exit sub
    end if
else
      pos=instr(login.phone.value,"-")
      len_phone=len(login.phone.value)
    if pos>1 and pos<len_phone then
        lef=left(login.phone.value,pos-1)
        rig=right(login.phone.value,len_phone-pos)
        if not isnumeric(lef) or not isnumeric(rig) or len(rig)<5 then
            msgbox"电话号码输入有误"
            login.phone.select
            exit sub
        end if
    else
        msgbox"电话号码输入有误"
        login.phone.select
        exit sub
    end if
end if
end if

if login.email.value="" then
msgbox "请填写邮箱地址"
login.email.select
exit sub
else
    if  not  right(login.email.value,4)=".com" and not
right(login.email.value,4)=".net" and not
right(login.email.value,3)=".cn" or
instr(login.email.value,"@")<=1 or instr(login.email.value,"@.") then
msgbox"请输入正确的邮箱"
login.email.select
exit sub
end if
end if
login.submit
end sub
-->
</script>


<html>
<head>
<title>会员注册</title>
<style type="text/css">
<!--
.style5 {font-size:smaller}
.style6 {color:#ff0000}
-->
</style>
</head>
<body leftmargin="20" class="class2">
 <span class="style5"><font color="#ff0000">您的位置:注册页面&nbsp;&nbsp;&nbsp;注意:带*的项目为必填项目</font></span>
 <br>
  <hr color="#999933" size="1">
  <form method="post" action="custadd.asp" name="login">
  <p class="style5"> 会员名:
  <input type="text" name="userid" size="15" maxlength="8" class="style5">
  <span class="style6">*</span>(用户名长度为3~8位)<br>
  <br>
  密码:
  <input type="password" name="userpw" size="15" maxlength="8" class="style5">
  <span class="style6">*</span>(密码长度为4~8位)<br>
  <br>
  确认密码:
  <input type="password" name="verifyow" size="15" class="style5">
  <span class="style6">*</span><br>
  <br>
  您的姓名:
  <input type="text" name="name" size="15" maxlength="8" class="style5">
  <span class="style6">*</span><br>
  <br>
  您的身份证号:
  <input type="text" name="idnumber" size="20" maxlength="18" class="style5">
  <span class="style6">*</span><br>
  <br>
  性 别:
  <input name="sex" type="radio" class="style5" value="男" checked>
  
  <input name="sex" type="radio" class="style5" value="女">
  
  <span class="style6">*</span><br>
  <br>
  您的年龄:
  <input type="text" name="age" size="5" maxlength="2" class="style5">
  <span class="style6">*</span><br>
  <br>
  详细地址:
  <input type="text" name="address" size="20" class="style5">
  <span class="style6">*</span><br>
  <br>
  邮政编码:
  <input type="text" name="zipcode" size="20" maxlength="6" class="style5">
  <span class="style6">*</span><br>
  <br>
  电话号码:
  <input type="text" name="phone" size="20" class="style5">
  <br>
  <br>
  电子邮箱:
  <input name="email" size="20" type="text" maxlength="30" class="style5">
  <span class="style6">*</span><br>
  <br>
  
  <input name="tijiao" type="submit" class="style5" value="提交" id="submit">
  <input name="chongzhi" type="reset" class="style5" value="重置">
  </p>
 </form>
 </body>
 </html>
搜索更多相关主题的帖子: 密码 language 用户名 
2011-10-16 16:07
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:20 
程序代码:
<html>
<head>
<title>会员注册</title>
<style type="text/css">
<!--
.style5 {font-size:smaller}
.style6 {color:#ff0000}
-->
</style>
<script language="vbscript">
<!--
function subimtClick()
  if len(login.userid.value)<3 then
     msgbox "用户名太短,请选择一个长度大于三个字符的名字"
     login.userid.select
     exit function
  end if                                                                 

  if instr(trim(login.userid.value)," ")>1 then
     msgbox "用户名中不能含有空格"
     login.userid.select
     exit function
   end if    
   if len(login.userpw.value)<4 then
      msgbox "密码太短,请选择一个长度大于4的密码"
      login.userpw.select
      exit function
   end if   
   if login.userpw.value<>login.verifypw.value then
      msgbox"两次输入的密码不相同"
      login.userpw.value=""
      login.verifypw.value=""
      login.userpw.select
      exit function
   end if
   if login.name.value=""then
      msgbox"为了为您提供更好地服务请输入名字"
      login.name.select
      exit function
   end if
   if login.idnumber.value="" or Not isnumeric(login.idnumber.value) or len(login.idnumber.value)<>15 and len(login.idnumber.value)<>18 then
      msgbox"请输入正确的身份证号码"
      login.idnumber.select
      exit function
   end if
   if login.age.value="" or Not isnumeric(login.age.value) then
       msgbox "请输入你得年龄"
       login.age.select
       exit function
   else
       if cint(login.age.value)<12 then
          msgbox"年龄输入范围有误"
          login.age.select
          exit function
       end if
    end if     
    if login.address.value=""then
       msgbox"请输入您的详细地址"
       login.address.select
       exit function
    end if
    if len(login.zipcode.value)<>6 or Not isnumeric(login.zipcode.value) then
       msgbox "邮政编码有误,请更正"
       login.zipcode.select
       exit function
    end if
    if not login.phone.value=""then
       if isnumeric(login.phone.value)<8 or left(login.phone.value,1)="1" or left(login.phone.value,1)="+" then
          msgbox "电话号码有误"
          login.phone.select
          exit function
       end if
    else
       pos=instr(login.phone.value,"-")
       len_phone=len(login.phone.value)
       if pos>1 and pos<len_phone then
          lef=left(login.phone.value,pos-1)
          rig=right(login.phone.value,len_phone-pos)
          if not isnumeric(lef) or not isnumeric(rig) or len(rig)<5 then
             msgbox"电话号码输入有误"
             login.phone.select
             exit function
          end if
       else
          msgbox"电话号码输入有误"
          login.phone.select
          exit function
       end if
     end if
     if login.email.value="" then
        msgbox "请填写邮箱地址"
        login.email.select
        exit function
    else
        if not right(login.email.value,4)=".com" and not right(login.email.value,4)=".net" and not right(login.email.value,3)=".cn" or instr(login.email.value,"@")<=1 or instr(login.email.value,"@.") then
           msgbox"请输入正确的邮箱"
           login.email.select
           exit function
        end if
     end if
     login.submit
end function
-->
</script>
</head>
<body leftmargin="20" class="class2">
<span class="style5"><font color="#ff0000">您的位置:注册页面&nbsp;&nbsp;&nbsp;注意:带*的项目为必填项目</font></span>
<br>
  <hr color="#999933" size="1">
  <form method="post" action="custadd.asp" name="login">
  <p class="style5"> 会员名:
  <input type="text" name="userid" size="15" maxlength="8" class="style5">
  <span class="style6">*</span>(用户名长度为3~8位)<br>
  <br>
  密码:
  <input type="password" name="userpw" size="15" maxlength="8" class="style5">
  <span class="style6">*</span>(密码长度为4~8位)<br>
  <br>
  确认密码:
  <input type="password" name="verifyow" size="15" class="style5">
  <span class="style6">*</span><br>
  <br>
  您的姓名:
  <input type="text" name="name" size="15" maxlength="8" class="style5">
  <span class="style6">*</span><br>
  <br>
  您的身份证号:
  <input type="text" name="idnumber" size="20" maxlength="18" class="style5">
  <span class="style6">*</span><br>
  <br>
  性 别:
  <input name="sex" type="radio" class="style5" value="" checked>
  男
  <input name="sex" type="radio" class="style5" value="">
  女
  <span class="style6">*</span><br>
  <br>
  您的年龄:
  <input type="text" name="age" size="5" maxlength="2" class="style5">
  <span class="style6">*</span><br>
  <br>
  详细地址:
  <input type="text" name="address" size="20" class="style5">
  <span class="style6">*</span><br>
  <br>
  邮政编码:
  <input type="text" name="zipcode" size="20" maxlength="6" class="style5">
  <span class="style6">*</span><br>
  <br>
  电话号码:
  <input type="text" name="phone" size="20" class="style5">
  <br>
  <br>
  电子邮箱:
  <input name="email" size="20" type="text" maxlength="30" class="style5">
  <span class="style6">*</span><br>
  <br>

 
  <input name="tijiao" type="button" onClick="subimtClick()" class="style5" value="提交" id="submit">
  <input name="chongzhi" type="reset" class="style5" value="重置">
  </p>
</form>
</body>
</html>
写完不调试吗?
2011-10-17 14:16
tcnxm23
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2011-10-16
收藏
得分:0 
回复 2楼 yms123
英雄,用什么调试啊?我用的DW写的,有什么能差错的工具么英雄?
2011-10-17 15:22
快速回复:为什么<script>代码不能用啊?
数据加载中...
 
   



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

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