javascript用户注册提示效果的简单实例
时间:2022-05-06 09:21:40|栏目:JavaScript代码|点击: 次
复制代码 代码如下:
<script type="text/javascript">
var $= function(id)
{
return document.getElementById(id);
}
function check()
{
if( $('username').value == "" )
{
$('eusername').innerHTML='<p class="login_jjB"> 请输入注册用户名!</p>';
return false;
}
else
{
$('eusername').innerHTML='';
}
if( $('passwd').value == "" )
{
$('epasswd').innerHTML='<p class="login_jjB"> 输入密码!</p>';
return false;
}
else
{
$('epasswd').innerHTML='';
}
if( $('passwd2').value != $('passwd').value )
{
$('epasswd2').innerHTML='<p class="login_jjB"> 两次输入密码不一致!</p>';
return false;
}
else
{
$('epasswd2').innerHTML='';
}
if( $('email').value == "" )
{
$('eemail').innerHTML='<p class="login_jjB"> 邮箱地址!</p>';
return false;
}
else
{
$('eemail').innerHTML='';
}
if( $('vaild').value == "" )
{
$('evaild').innerHTML='<p class="login_jjB"> 请输入右边验证码!</p>';
return false;
}
else
{
$('evaild').innerHTML='';
}
}
</script>
<form name="registerform" id="registerform" method="POST" action="">
<input type="hidden" name="action" value="register">
<input type="hidden" name="user_type" value="1">
<ul><li><h1>用户名:</h1>
<div class="login_jjA">
<span style="display:none;">
<select name="cityid" id="cityid" style="width:100px;" onblur="changelocation(document.registerform.cityid.options[document.registerform.cityid.selectedIndex].value)">
<option value="">--公司不限--</option>
<option value="2">--杭州舍易房地产代理有限公司--</option>
</select>
<select name="cityareaid" style="width:100px;" id="cityareaid">
<option value="0">--不限门店--</option>
</select>
</span>
<input name="username" id="username" type="text" class="jinru_in" value="" onblur="check();" onclick="check();" /></div>
<div id="eusername"></div>
</li>
<li><h1>密码:</h1>
<div class="login_jjA"><input name="passwd" type="password" id="passwd" class="jinru_in" onblur="check();" onclick="check();" /></div>
<div id="epasswd"></div>
</li>
<li><h1>确认密码:</h1>
<div class="login_jjA"><input name="passwd2" type="password" id="passwd2" class="jinru_in" onblur="check();" onclick="check();" /></div>
<div id="epasswd2"></div>
</li>
<li><h1>邮箱地址:</h1>
<div class="login_jjA"><input name="email" type="text" size="30" id="email" value="" class="jinru_in" onblur="check();" onclick="check();" /></div>
<div id="eemail"></div>
</li>
<li><h1>验证码:</h1>
<div class="login_jjA">
<input name="vaild" type="text" class="inlen" id="vaild" onblur="check();" onclick="check();" size="5" /><img src="/valid.php" /></div>
<div id="ever"></div>
</li>
<li style="height:35px;"><h1> </h1>
<div class="jinruD"><input value=" " type="submit" onclick="javascript:return check();" class="login_jj_btn"/></div>
</li>
</ul>
</form>
栏 目:JavaScript代码
本文地址:http://www.codeinn.net/misctech/201178.html