Function FrmAddLink_onsubmit()
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()Function to open pop up window
Function openWin()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 =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 =class="time"><span Class =class="time style1"><span Class =class="time style5">
<select name="byear" size="1" Class =class="put" id="select14">
<option value="<%=byear%>"><%=byear%></option>
<%for i=year(date) to 1900 step -1%>
<option value="<%=i%>"><%=i%></option>
<%next%>
</select>
年
<select name="bmonth" size="1" Class =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 =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>
---------------------------------------------------------------------------
-----------------------------------------------------------------------------
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()Function to open pop up window
Function openWin()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 =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 =class="time"><span Class =class="time style1"><span Class =class="time style5">
<select name="byear" size="1" Class =class="put" id="select14">
<option value="<%=byear%>"><%=byear%></option>
<%for i=year(date) to 1900 step -1%>
<option value="<%=i%>"><%=i%></option>
<%next%>
</select>
年
<select name="bmonth" size="1" Class =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 =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;
}
}
</ 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;
}
}