註冊時常用

function FrmAddLink_onsubmit() {
var i, n;
if (document.FrmAddLink.username.value=="")
    {
      alert(
"對不起,請輸入您的用戶名!")
      document.FrmAddLink.username.focus()
      
return false
     }
else if (document.FrmAddLink.username.value.length < 2)
    {
      alert(
"您的用戶名能不能長一點!")
      document.FrmAddLink.username.focus()
      
return false
     }
else if (document.FrmAddLink.username.value.length > 30)
    {
      alert(
"您的用戶名太長了吧!")
      document.FrmAddLink.username.focus()
      
return false
     }
else if (document.FrmAddLink.username.value.indexOf('`') >= 0 ||
          document.FrmAddLink.username.value.indexOf('~') >= 0 ||
          document.FrmAddLink.username.value.indexOf('!') >= 0 ||
          document.FrmAddLink.username.value.indexOf('@') >= 0 ||
          document.FrmAddLink.username.value.indexOf('#') >= 0 ||
          document.FrmAddLink.username.value.indexOf('$') >= 0 ||
          document.FrmAddLink.username.value.indexOf('%') >= 0 ||
          document.FrmAddLink.username.value.indexOf('^') >= 0 ||
          document.FrmAddLink.username.value.indexOf('&') >= 0 ||
          document.FrmAddLink.username.value.indexOf('*') >= 0 ||
          document.FrmAddLink.username.value.indexOf('(') >= 0 ||
          document.FrmAddLink.username.value.indexOf(')') >= 0 ||
          document.FrmAddLink.username.value.indexOf('+') >= 0 ||
          document.FrmAddLink.username.value.indexOf('{') >= 0 ||
          document.FrmAddLink.username.value.indexOf('}') >= 0 ||
          document.FrmAddLink.username.value.indexOf('|') >= 0 ||
          document.FrmAddLink.username.value.indexOf('[') >= 0 ||
          document.FrmAddLink.username.value.indexOf(']') >= 0 ||
          document.FrmAddLink.username.value.indexOf('/') >= 0 ||
          document.FrmAddLink.username.value.indexOf(';') >= 0 ||
          document.FrmAddLink.username.value.indexOf(':') >= 0 ||
          document.FrmAddLink.username.value.indexOf('>') >= 0 ||
          document.FrmAddLink.username.value.indexOf('<') >= 0 ||
          document.FrmAddLink.username.value.indexOf(',') >= 0 ||
          document.FrmAddLink.username.value.indexOf('?') >= 0 ||
          document.FrmAddLink.username.value.indexOf('/') >= 0 || 
          document.FrmAddLink.username.value.indexOf(''') >= 0 || 
          document.FrmAddLink.username.value.indexOf('"') >= 0 || 
          document.FrmAddLink.username.value.indexOf(' ') >= 0 || 
          document.FrmAddLink.username.value.indexOf('=') >= 0 || 
          document.FrmAddLink.username.value.indexOf('%') >= 0
         )  
          {
            alert(
"用戶名中包含無效字符,請重新選擇用戶名!"); 
            document.FrmAddLink.username.focus();
            
return false;
          }
else if (document.FrmAddLink.passwd.value=="")
    {
      alert(
"對不起,請您輸入密碼!")
      document.FrmAddLink.passwd.focus()
      
return false
     }
else if (document.FrmAddLink.passwd.value.length < 4)
    {
      alert(
"爲了安全,您的密碼應該長一點!")
      document.FrmAddLink.passwd.focus()
      
return false
     }
else if (document.FrmAddLink.passwd.value.length > 16)
    {
      alert(
"您的密碼太長了吧!")
      document.FrmAddLink.passwd.focus()
      
return false
     }
else if (document.FrmAddLink.username.value==document.FrmAddLink.passwd.value)
    {
      alert(
"爲了安全,用戶名與密碼不應該相同!")
      document.FrmAddLink.passwd.focus()
      
return false
     }
else if (document.FrmAddLink.passwd2.value=="")
    {
      alert(
"對不起,請您輸入驗證密碼!")
      document.FrmAddLink.passwd2.focus()
      
return false
     }
else if (document.FrmAddLink.passwd2.value !== document.FrmAddLink.passwd.value)
    {
      alert(
"對不起,您兩次輸入的密碼不一致!")
      document.FrmAddLink.passwd2.focus()
      
return false
     }
else if (document.FrmAddLink.question.value=="")
    {
      alert(
"對不起,請您輸入提示問題!")
      document.FrmAddLink.question.focus()
      
return false
     }
else if (document.FrmAddLink.answer.value=="")
    {
      alert(
"對不起,請您輸入問題答案!")
      document.FrmAddLink.answer.focus()
      
return false
     }
else if (document.FrmAddLink.question.value==document.FrmAddLink.answer.value)
    {
      alert(
"爲了安全,提示問題與問題答案不應該相同!")
      document.FrmAddLink.answer.focus()
      
return false
     }
else if (document.FrmAddLink.fullname.value=="")
    {
      alert(
"對不起,請輸入您的真實姓名!")
      document.FrmAddLink.fullname.focus()
      
return false
     }
else if (document.FrmAddLink.tel.value=="")
    {
      alert(
"對不起,請輸入您的聯繫電話!")
      document.FrmAddLink.tel.focus()
      
return false
     }
else if (document.FrmAddLink.email.value=="")
    {
      alert(
"對不起,請輸入您的電子郵件!")
      document.FrmAddLink.email.focus()
      
return false
     }
else if (document.FrmAddLink.email.value.indexOf("@",0)== -

1||document.FrmAddLink.email.value.indexOf(".",0)==-1)
      {
      alert(
"對不起,您輸入的電子郵件有誤!")
      document.FrmAddLink.email.focus()
      
return false
     }
}


if mianmaotime<>""then
  
if not isdate(mianmaotime) then
response.Write 
"<script language=javascript>{window.alert('您輸入的“政治面貌時間”格式錯誤

!正確的格式爲1998
-12-6、1998年12月6日、1998/12/6');window.history.go(-1);}</script>"
response.End
end if
end if


if email<>"" then
Dim regEx, Match ' Create variables.
Set regEx = New RegExp ' Create a regular expression object (stupid, huh?)
regEx.Pattern = "^w+((-w+)|(.w+))*@[A-Za-z0-9]+((.|-)[A-Za-z0-9]+)*.[A-Za-z0-9]+$" ' 

Sets pattern.
regEx.IgnoreCase 
= True ' Set case insensitivity.
Set Match = regEx.Execute(email) ' Execute search.
if  match.count=0 then 
response.Write 
"<script language=javascript>{window.alert('您輸入的“email”格式錯

誤!
');window.history.go(-1);}</script>"
response.End
end if
end if
//Function to open pop up window
function openWin(theURL,winName,features) {
      window.open(theURL,winName,features);
}
---------------------------------------------------------------------------
---------------------------------------------------------------------------
    
dim a
    
set rs1=server.CreateObject("adodb.recordset")
    a
=request("zwbh")
    sql
="select * from 領導成員 where 職位編號="+a
        rs1.open sql,conn,
1,3
    
if rs1.recordcount>=1 Then
    response.write 
"<font color=red><center>己經被用</center></font>" 
    response.redirect
"index.asp" 
    
end if 

 
if username<>"" and password<>"" then
   response.Write
"<script language='javascript'>"
    response.Write
"alert('用戶名或密碼填寫不正確,或者還沒註冊');"
    response.Write
"history.go(-1);"
    response.Write
"</script>"
    response.Redirect
"index.asp" 
    response.End  
   
end if

----------------------------------------------------------------------------
----------------------------------------------------------------------------
    beizhu
=request("beizhu")
      beizhu2 
= Replace(beizhu,chr(13),"<br>")
      rs(
"beizhu")=beizhu2

rs(
"lastupduser")=session("adminlogin")
      rs(
"lastupdname")=session("adminname")
      ip11 
= Request.ServerVariables("HTTP_X_FORWARDED_FOR"' 代理IP
ip22 =Request.ServerVariables("REMOTE_ADDR"
if ip11 = "" then
lastupdip 
= ip22
else
lastupdip 
= ip11
end if
      rs(
"lastupdip")=lastupdip
      rs(
"lastupddate")=now
      rs.update
      rs.close
      
set rs=nothing
      
'-----------------------***************
      ip111 = Request.ServerVariables("HTTP_X_FORWARDED_FOR"' 代理IP
ip222 =Request.ServerVariables("REMOTE_ADDR"
if ip111 = "" then
ipupdate 
= ip222
else
ipupdate 
= ip111
end if
jgpcname
=Request.ServerVariables("HTTP_USER_AGENT")
sql_jgupddiary
="select * from updjgdiary"
set rs_jgupddiary=server.CreateObject("adodb.recordset")
rs_jgupddiary.open sql_jgupddiary,conn,
1,2
rs_jgupddiary.addnew
      rs_jgupddiary(
"id")=jgid '校友ID號
       rs_jgupddiary("jg_name")=name '校友姓名
      rs_jgupddiary("lastupduser")=session("adminlogin")
      rs_jgupddiary(
"lastupdname")=session("adminname")
      rs_jgupddiary(
"lastupddate")=now
      rs_jgupddiary(
"lastupdip")=ipupdate
      rs_jgupddiary(
"os")=jgpcname
      rs_jgupddiary.update
      rs_jgupddiary.close
      
set rs_jgupddiary=nothing
      
'------------------------------********************
response.Write "<script language=javascript>{window.alert('記錄更新成功!請點擊“確定”返回   ');window.history.go(-2);}</script>"
時間差距
<
    
if rs("birthday")<>"" and isdate(rs("birthday")) then
    bir
=rs("birthday")
    age
=datediff("yyyy",bir,date)
    
else age=""
    
end if
    
    
if rs("workstart")<>"" and isdate(rs("workstart")) then
    workdate
=rs("workstart")
    jiaolin
=datediff("yyyy",workdate,date)
    
else jiaolin=""
    
end if
%
>
<td ><div align="center"><%=age%></div></td>

--------------------------------------------------------------------------
--------------------------------------------------------------------------
     
<font color="#FF0000" class="time">
        
<%
    
if  isdate(rs("birthday"))then
    byear
=year(rs("birthday"))
    bmonth
=month(rs("birthday"))
    bday
=day(rs("birthday"))
    
end if
    %
>
        
<font color="#FF0000" class="time"><span class="time style1"><span class="time style5">
        
<select name="byear" size="1" class="put" id="select14">
          
<option value="<%=byear%>"><%=byear%></option>
          
<%for i=year(dateto 1900 step -1%>
          
<option value="<%=i%>"><%=i%></option>
          
<%next%>
        
</select>
        年
        
<select name="bmonth" size="1" class="put" id="select15">
          
<option value="<%=bmonth%>"><%=bmonth%></option>
          
<%for i=1 to 12%>
          
<option value="<%=i%>"><%=i%></option>
          
<%next%>
        
</select>
        月
        
<select name="bday" size="1" class="put" id="select16">
          
<option value="<%=bday%>"><%=bday%></option>
          
<%for i=1 to 31%>
          
<option value="<%=i%>"><%=i%></option>
          
<%next%>
        
</select>
        日
</span></span></font></font></td>
---------------------------------------------------------------------------
-----------------------------------------------------------------------------
 

動態調用數據庫內容:

<td height="32" valign="middle" width="380">以下是從數據庫中調出數據
<select name="areaid">
<%
set rs = createobject("ADODB.recordset")
sql="select * from areainfo where provinceid='"&provinceid&"'"
rs.open SQL,schooldb
while not rs.eof
%>
<option value="<%=rs("areaid")%>"><%=rs("areaname")%></option>
<%
rs.movenext
wend
rs.close
%>
</select>
</ td>

 

<form onSubmit="return check()">

</form>
 
function  check()
  
{
     
if (form1.name.value=="")
       
{
         alert(
"姓名不能爲空!!!");
         
return false;
        }

       
if (form1.age.value=="")
       
{
         alert(
"年齡不能爲空!!!");
         
return false;
        }

    
var filter=/^s*[.0-9]{1,3}s*$/;
        
if (!filter.test(form1.age.value)) 
             

                alert(
"年齡填寫不正確,請重新填寫!可使用的字符爲(0-9)長度不超過3個字符,注意不要使用空格。"); 
                
return false

                }
 
}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章