87,903
社区成员
发帖
与我相关
我的任务
分享
<div class='txt name fixed'>
<span class='txt_sp1'></span>
<input type='text' id='txtname' maxlength='10' class='txt_sp2' placeholder='资金帐号' />
<span class='txt_sp3'></span>
<span class='txt_sp4'></span>
<span class='txt_sp6'>帐号不能为空</span>
</div>
<div class='txt pwd fixed'>
<span class='txt_sp1'></span>
<input type='password' id='txtpwd' maxlength='6' class='txt_sp2' placeholder='交易密码' />
<span class='txt_sp3'></span>
<span class='txt_sp4'></span>
<span class='txt_sp6'>密码不能为空</span>
</div>
//删除文本框内容
$('.txt_sp3').click(function(){
$(this).prev().val('');
$(this).prev().focus();
})
//当前文本框失去焦点时
$('.txt_sp2').blur(function(){
$(this).prev().removeAttr("style");//变换图标
var isClick=false;
//判断文本框内容是否正确并提示
var n=$(this).val();
if (n.length==0||isNaN(n)) {
$(this).parent().css({'background':'url(images/txtbg2.png) no-repeat'});
$(this).next().css('display','none');
$('.txt_sp5').css('display','block');
$(this).parent().children('.txt_sp4').css('display','block');
//弹出提示框效果
$(this).parent().each(function() {
$(this).stop()
.animate({ left: "-5px" }, 50).animate({ left: "5px" }, 50)
.animate({ left: "-5px" }, 50).animate({ left: "5px" }, 50)
.animate({ left: "0px" }, 50)
});
$(this).parent().children('.txt_sp4').click(function(){
$(this).parent().children('.txt_sp6').css('display','block');
})
}else{
$(this).parent().removeAttr('style');
x=1;
}
var name=$('#txtname').val();
var pwd=$('#txtpwd').val();
if (isNaN(name)) {
$('.name>.txt_sp6').html('帐号必须为10位数字');
}
if (isNaN(pwd)) {
$('.name>.txt_sp6').html('密码必须为6位数字');
}
if (name.length==0) {
$('.pwd>.txt_sp6').html('帐号不能为空');
}
if (pwd.length==0) {
$('.pwd>.txt_sp6').html('密码不能为空');
}
})
$('.txt_sp2').blur(function () {
var me = this;////////////////做好闭包指向对象
setTimeout(function () {
$(me).prev().removeAttr("style"); //变换图标
var isClick = false;
//判断文本框内容是否正确并提示
var n = $(me).val();
if (n.length == 0 || isNaN(n)) {
$(me).parent().css({ 'background': 'url(images/txtbg2.png) no-repeat' });
$(me).next().css('display', 'none');
$('.txt_sp5').css('display', 'block');
$(me).parent().children('.txt_sp4').css('display', 'block');
//弹出提示框效果
$(me).parent().each(function () {
$(this).stop()
.animate({ left: "-5px" }, 50).animate({ left: "5px" }, 50)
.animate({ left: "-5px" }, 50).animate({ left: "5px" }, 50)
.animate({ left: "0px" }, 50)
});
$(me).parent().children('.txt_sp4').click(function () {
$(this).parent().children('.txt_sp6').css('display', 'block');
})
} else {
$(me).parent().removeAttr('style');
x = 1;
}
var name = $('#txtname').val();
var pwd = $('#txtpwd').val();
if (isNaN(name)) {
$('.name>.txt_sp6').html('帐号必须为10位数字');
}
if (isNaN(pwd)) {
$('.name>.txt_sp6').html('密码必须为6位数字');
}
if (name.length == 0) {
$('.pwd>.txt_sp6').html('帐号不能为空');
}
if (pwd.length == 0) {
$('.pwd>.txt_sp6').html('密码不能为空');
}
}, 100);
});