各位大侠,本人想在下面代码作个判断是否和数据库用户名重复的条件想出现一个script对话框的效果
小弟在线等待
<%@ Language=VBScript %>
<HTML>
<HEAD>
<meta http-equiv="Content-Language" content="zh-cn">
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
</HEAD>
<body>
<form method="post" action="logina.asp" name="form1">
<p align="center"><b><font size="5">用户注册</font></b></p>
<table border="1" width="521" height="207" align="center">
<tr>
<td height="23" width="166">
<p align="right">
姓名:</p>
</td>
<td height="23" width="330"> <input type="text" name="name" size="19" class="text" ID="Text1"> <font color="red">*</font>
</td>
</tr>
<tr>
<td height="23" width="166">
<p align="right">
密码:</p>
</td>
<td height="23" width="330"> <input type="password" name="password1" size="25" class="text" ID="Text2">
<font color="red">*</font></td>
</tr>
<tr>
<td height="23" width="166">
<p align="right">
确认密码:</p>
</td>
<td height="23" width="330"> <input type="password" name="password2" size="25" class="text" ID="Text3">
<font color="red">*</font>
</td>
</tr>
<tr>
<td height="23" width="166">
<p align="right">
Email:</p>
</td>
<td height="23" width="330"> <input type="text" name="Email" size="34" class="text" ID="Text4">
<font color="red">*</font></td>
</tr>
<tr>
<td height="23" width="166">
<p align="right">
个人主页:</p>
</td>
<td height="23" width="330"> <input type="text" name="homepage" size="40" class="text" ID="Text5">
<font color="red">*</font></td>
</tr>
<tr>
<td height="92" width="166">
<p align="right">
自我介绍:</p>
</td>
<td height="92" width="330"> <textarea rows="6" name="note" cols="32" id="text6"></textarea></td>
</tr>
</table>
<p align="center"><input id="submit1" type="submit" value="提交" onclick="javascript:checkvalue();return false;"
name="B1"> <input type="reset" value="重置" name="B2"></p>
<script language="javascript">
function checkvalue()
{
if(document.form1.Text1.value=="")
{
alert("姓名不能为空!");
return (false);
}
if(document.form1.Text2.value=="")
{
alert("密码不能为空!");
return (false);
}
if(document.form1.Text3.value=="")
{
alert("确认密码不能为空!");
return (false);
}
if(document.form1.Text2.value!=document.form1.Text3.value)
{
alert("两次密码输入不一致!")
return false;
}
if(document.form1.Text4.value=="")
{
if(document.form1.Text4.value.charAt(0)=="."||
document.form1.Text4.value.charAt(0)=="@"||
document.form1.Text4.value.index0f('@', 0) == -1||
document.form1.Text4.value.index0f('@', 0) == -1||
document.form1.Text4.value.lastIndexOf("@")==document.form1.Text4.value.length-1 ||
document.form1.Text4.value.lastIndexOf(".")==document.form1.Text4.value.length-1)
{
alert("Email格式不正确!");
document.form1.Text4.focus();
return false;
}
else
{
alert("Email不能为空!");
document.form1.Text4.focus();
return false;
}
}
if(document.form1.Text5.value=="")
{
alert("个人主页不能为空!");
return false;
}
document.form1.submit();
return (true);
}
</script>
</form>
</body>
</HTML>