日期:2014-05-16 浏览次数:20538 次
//绑定输入框事件
(function(){
var oLo = $id('loginBtn'),
oRg = $id('lfBtnReg'),
oAutoTips = $id('whatAutologinTip'),
oPwLabel = $id('pwdPlaceholder');
//帐号
fEventListen(oIdL,'mouseover',function(){
oIdL.className += ' loginFormIpt-over';
});
fEventListen(oIdL,'mouseout',function(){
oIdL.className = oIdL.className.replace(/\sloginFormIpt-over/g, '');
});
fEventListen(oId,'focus',function(){
oId.className += ' loginFormTdIpt-focus';
oIdL.className += ' loginFormIpt-focus';
});
fEventListen(oId,'blur',function(){
oIdL.className = oIdL.className.replace(/\sloginFormIpt-focus/g, '');
if(oId.value == ''){
oIdL.className += ' showPlaceholder';
oId.className = oId.className.replace(/\sloginFormTdIpt-focus/g, '');
}else{
oId.value = fCheckAccount(oId.value);
}
});
function fIdInputEvent(){
if(oId.value==''){
oIdL.className += ' showPlaceholder';
}else{
oIdL.className = oIdL.className.replace(/\sshowPlaceholder/g, '');
var b = new RegExp(/\sloginFormTdIpt-focus/g).test(oId.className);
if(!b){
oId.className += ' loginFormTdIpt-focus';
}
}
}
var sEventName = '';
var bIsIe = false;
if(document.body.onpropertychange === null){
sEventName = 'propertychange';
var bIsIe = true;
}else{
sEventName = 'input';
fCheckAlways();
}
var el = document.createElement('div');
el.setAttribute('oninput', 'return;')
if(typeof el.oninput === 'function'){
sEventName = 'input';
if(bIsIe){
fCheckAlways();
}
}
fEventListen(oId, sEventName, fIdInputEvent);
//点击双击文字
fEventListen(oIdLabel, 'dbclick', function(){
oId.focus();
});
fEventListen(oIdLabel, 'click', function(){
oId.focus();
});
//密码
fEventListen(oPwL,'mouseover',function(){
oPwL.className += ' loginFormIpt-over';
});
fEventListen(oPwL,'mouseout',function(){
oPwL.className = oPwL.className.replace(/\sloginFormIpt-over/g, '');
});
fEventListen(oPw,'focus',function(){
oPw.className += ' loginFormTdIpt-focus';
oPwL.className += ' loginFormIpt-focus';
fCheckPw(100);
});
fEventListen(oPw,'blur',function(){
oPwL.className = oPwL.className.replace(/\sloginFormIpt-focus/g, '');
if(oPw.value == ''){
oPwL.className += ' showPlaceholder';
oPw.className = oPw.className.replace(/\sloginFormTdIpt-focus/g, '');
}
});
function fPwInputEvent(){
if(oPw.value==''){
oPwL.className += ' showPlaceholder';
}else{
oPwL.className = oPwL.className.replace(/\sshowPlaceholder/g, '');
var b = new RegExp(/\sloginFormTdIpt-focus/g).test(oPw.className);
if(!b){
oPw.className += ' loginFormTdIpt-focus';
}
}
}
fEventListen