各位大侠,本人想在下面代码作个判断是否和数据库用户名重复的条件想出现一个script对话框的效果

yangyifand 2005-09-13 07:59:08
小弟在线等待
<%@ 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>
...全文
77 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
frostnet 2005-09-14
  • 打赏
  • 举报
回复
你可以在你logina.asp页面中判断后,加入:
response.write "<script>alert('对不起,用户名重复!');history.back()</script>"
yangyifand 2005-09-14
  • 打赏
  • 举报
回复
我是要做一个输入的用户名和数据库的用户名不能一样
要做个判断出现一个script的对话框
我只想用一个页面就搞定
yangyifand 2005-09-14
  • 打赏
  • 举报
回复
那位大哥可以和我些的详细点吗?
我要写成
If not conn.Execute("Select id From user where username='"&username&"'" ).eof or username="" Then error2("您所选的用户名 "&username&" 已经有人使用,请另外选择一个用户名。")
前面要写些什么啊,麻烦各位大侠写清楚点拜托了
holoon 2005-09-13
  • 打赏
  • 举报
回复
提交时,和数据库中的字段的值对比。

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧