<SCRIPT LANGUAGE="JavaScript">
function jj(){
if(document.getElementByIdx_x_x('name').value==''){
alert('用户名不能为空');
return false;
}
if(document.getElementByIdx_x_x('phone').value==''){
alert('电话不能为空');
return false;
}
if(document.getElementByIdx_x_x('password').value==''){
alert('密码不能为空');
return false;
}
if(document.getElementByIdx_x_x('password').value != document.getElementByIdx_x_x('password2').value){
alert('两次输入的密码不一样');
return false;
}
if(!document.getElementByIdx_x_x('agreement').checked ==true){
alert('你还没有接受用户协议');
return false;
}
}
function hh(x,y){
if(document.getElementByIdx_x_x(x).value ==''){
document.getElementByIdx_x_x(y).innerHTML='带*号的为必填,请不要留下空格';
}
}
</SCRIPT>
<form action="" method="post" οnsubmit="return jj()">
<table width="100%" border="0">
<tr>
<td width="40%" align="right">用户名:</td>
<td width="60%"><input type="text" size="25" id="name" name="user_name" οnblur="hh('name','name_notice')" />
<span id="name_notice" style="color:#FF0000">*</span></td>
</tr>
<tr>
<td width="40%" align="right">电话:</td>
<td width="60%"><input type="text" size="25" id="phone" name="user_phone" οnblur="hh('phone','phone_notice')" />
<span id="name_notice" style="color:#FF0000">*</span></td>
</tr>
<tr>
<td width="40%" align="right">密码:</td>
<td width="60%"><input type="password" size="25" id="password" name="pwd" οnblur="hh('password','password_notice')" />
<span id="password_notice" style="color:#FF0000">*</span></td>
</tr>
<tr>
<td width="40%" align="right">重复密码:</td>
<td width="60%"><input type="password" size="25" id="password2" name="pwd2" οnblur="hh('password2','password_notice')" />
<span id="password_notice2" style="color:#FF0000">*</span></td>
</tr>
<tr>
<td align="center" colspan="2"><label>
<input name="agreement" type="checkbox" id='agreement' οnblur="hh('agreement','agreement_notice')"/>
我已看过并接受《<a href="article.php?cat_id=-1" style="color:blue" target="_blank">用户协议</a>》</label></td>
</tr>
<tr>
<td align="center" colspan="2"><input type="submit" value="注册" name="a" /></td>
</tr>
</table>
function jj(){
if(document.getElementByIdx_x_x('name').value==''){
}
if(document.getElementByIdx_x_x('phone').value==''){
}
if(document.getElementByIdx_x_x('password').value==''){
}
if(document.getElementByIdx_x_x('password').value != document.getElementByIdx_x_x('password2').value){
}
if(!document.getElementByIdx_x_x('agreement').checked ==true){
}
}
function hh(x,y){
if(document.getElementByIdx_x_x(x).value ==''){
}
}
</SCRIPT>
<form action="" method="post" οnsubmit="return jj()">
<table width="100%" border="0">
</table>