<%
Function GetValidateCode()
Randomize Timer '产生一个随机树
GetValidateCode=Left(Int(Rnd*9998)+1000,4)
If Len(GetValidateCode)>4 Then
GetValidateCode=Len(GetValidateCode&9999,4)
End If
End Function
%>
<!--#include file="lj_conn.asp"-->
<%
if request.QueryString("action")="add" then
l_url=trim(request.Form("url"))
l_url=replace(l_url,"'","")
l_font=trim(request.Form("name"))
l_font=replace(l_font,"'","")
l_logo=trim(request.Form("adress"))
l_logo=replace(l_logo,"'","")
l_alt=trim(request.Form("demo"))
l_alt=replace(l_alt,"'","")
key=trim(request.Form("key"))
key=replace(key,"'","")
if l_url <> "" and l_font <> "" and l_logo <> "" and l_alt <> "" and ValidateCode=key then
conn.execute "insert into lianjie(l_url,l_font,l_logo,l_alt) values('"&l_url&"','"&l_font&"','"&l_logo&"','"&l_alt&"')"
response.Write("<script language='javascript'>alert('联结已经成功注册,请等待审核!');histotry.go(-1);</script>")
else
if l_url="" then
msg=msg&"地址不能为空!"
elseif l_font="" then
msg=msg&"网站名称不能为空!"
elseif l_logo="" then
msg=msg&"图片不能为空!"
elseif l_alt="" then
msg=msg&"备注不能为空!"
elseif request.Form("key") <> ValidateCode then
msg=msg&"验证码错误!"
end if
response.Write("<script language='javascript'>alert(信息没有填写完整!);histotry.go(-1);</script>")
end if
end if
%>
</head>
<body>
<form id="form1" name="form1" method="post" action="lj_add.asp?action=add">
<div align="center">
<table width="524" height="202" border="1">
<tr>
<td width="154">网站名称:</td>
<td width="354"><label>
<input name="name" type="text" id="name" />
</label></td>
</tr>
<tr>
<td>联结地址:</td>
<td><label>
<input name="url" type="text" id="url" />
</label></td>
</tr>
<tr>
<td>图片地址:</td>
<td><label>
<input name="adress" type="text" id="adress" />
</label></td>
</tr>
<tr>
<td>站点说明:</td>
<td><label>
<input name="demo" type="text" id="demo" />
</label></td>
</tr>
<tr>
<td>验证 码:</td>
<td><label>
<%ValidateCode=GetValidateCode()'将获取的验证码赋值给ValidateCode%>
<input type="hidden" name="ValidateCode" value="<%=ValidateCode%>">
<input name="key" type="text" class="input3" id="key" size="5" maxlength="4">
<%=ValidateCode%>
</label></td>
</tr>
<tr>
<td><label>
<input type="submit" name="Submit" value="提交" />
</label></td>
<td><label>
<input type="reset" name="Submit2" value="重置" />
</label></td>
</tr>
</table>
</div>
</form>
就这代码,我都不知道怎么错了,郁闷,看不出有什么错误啊,可是注册值为空的时候,根本就没有弹出错误提示对话框,但是插入的时候可以正常操作,奇怪了!