如何判断新输入的注册用户名是否在数据库中存在
wydyl 2009-03-27 04:34:15 <head>
<title>My JSP 'reg.jsp' starting page</title>
<script type="text/javascript">
function regf(){
var name=document.getElementById("regName");//注册名
var pwd=document.getElementById("regPwd");//注册密码
var pwd1=document.getElementById("regPwd1");//重复密码
var sex=document.getElementById("sex");//选择的性别
var head=document.getElementById("head");//选择的头像
if(name.value.length==0){
alert("用户名不能为空!");
return false;
}
if(pwd.value.length==0){
alert("密码不能为空!");
return false;
}if(pwd.value.length>=0&&pwd.value.length<6)
{
alert("密码长度必须大于六位!");
return false;
}
if(pwd1.value.length==0){
alert("必须输入重复密码");
return false;
}
if(pwd1.value!=pwd.value)
{
alert("你输入的密码不相符合!请重新输入");
return false;
}
if(sex.checked(false)){
alert("请选择性别!");
return false;
}
if(sex.value.length==0){
alert("请选择头像!");
return false;
}
return true;
}
function doTest(){
}
</script>
</head>
<body>
%>
<%@ include file="../include/includeTop.jsp" %>
<p>
>><a href="index.jsp" style="color:darkblue; font-size:12px;"/> 论坛首页</a>
</p>
<form name="f1" method="post" action="../Pro/proReg.jsp" onsubmit="return regf()">
<div style="border:1px solid #6699cc;height:150px;">
<table width="950px" style="font-size:12px;margin-top:35px; ">
<tr align="center">
<td>用户名 <input type="text" name="regName" id="regName" value="" style="width:160px;border:1px solid #6699cc"/>
<INPUT TYPE="RESET" NAME="BUTTON" VALUE="是否可用" ONCLICK="doTest()">
</td>
</tr>
<tr align="center">
<td>密 码 <input type="password" name="regPwd" id="regPwd" value="" style="width:160px;border:1px solid #6699cc"/></td>
</tr>
<tr align="center">
<td>重复密码 <input type="password" name="regPwd1" id="regPwd1" value="" style="width:160px;border:1px solid #6699cc"/></td>
</tr>
<tr align="center">
<td>性别 <input type="radio" name="sex" id="sex" value="">男 <input type="radio" name="sex" value="" checked="checked">女</td>
</tr>
<tr align="center">
<td>请选择头像</td>
</tr>
<tr align="center">
<td><img src="../images/head/1.gif"/><input type="radio" value="" name="head" checked="checked">
<img src="../images/head/2.gif"/><input type="radio" value="" name="head">
<img src="../images/head/3.gif"/><input type="radio" value="" name="head">
<img src="../images/head/4.gif"/><input type="radio" value="" name="head">
<img src="../images/head/5.gif"/><input type="radio" value="" name="head">
</td>
</tr>
我有一个问题想问问大家 当我注册用户的时候如何判断注册的用户名是否存在