jquery 版本1.10
<div id="container">
<!-- Content -->
<div id="content" class="colM">
<div id="content-main">
<div>
<h2>密码修改</h2>
<p>请输入你的旧密码,为了安全起见,接着要输入两遍新密码,以便我们校验你输入的是否正确。</p>
<fieldset class="module aligned wide">
<div class="form-row">
<label >旧密码:</label><input id="old_password" name="old_password" type="password"><span id="name_info1">*</span>
</div>
<div class="form-row">
<label >新密码:</label><input id="pass1" name="new_password" type="password"><span id="name_info2">*</span>
</div>
<div class="form-row">
<label>密码(重复):</label><input id="pass2" name="new_password2" type="password"><span id="name_info3">*</span>
</div>
</fieldset>
<div class="submit-row">
<input type="submit" value="修改我的密码" class="default">
</div>
<script>$("#old_password").focus();</script>
</div>
</form>
<script type="text/javascript">
$(function() {
$("#old_password").blur(function() {
if($("#old_password").val()=="")
{
$("span#name_info1").text('密码不能为空').css("color","red");
}
else
{
$("span#name_info1").text('√').css("color","green");//1.10 选择器span#name_info 用#name_info是错误的
}
});
$("#pass1").blur(function() {
if($("#pass1").val()=="")
{
$("span#name_info2").text('密码不能为空').css("color","green");
}
else
{
$("span#name_info2").text('√').css("color","green");
}
});
$("#pass2").blur(function() {
if($("#pass2").val()=="")
{
$("span#name_info3").text('密码不能为空').css("color","red");
}
else
{
$("span#name_info3").text('√').css("color","green");
}
});
});
</script>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。