Recently, I found that forms used in the project are difficult to verify. I wrote one by myself while referring to other users. When an error is returned during verification, the prompt message uses the fadeIn (fadeOut) transition (because the browser's efficiency is too high, it will pop up at a moment ~~); You must be compatible with IE (element. style. filter = 'Alpha (opacity = value) ') and non-IE (element. style. opacity = value.
In addition, note that the value of non-IEopaciy is 0 ~ 1, IE is 1-100.
Below, paste the Code:
The Code is as follows:
/**
* @ ProjectDescription: Specifies the animation (Fade-in and fade-out) class.
*/**
* @ ProjectDescription KINGKIT UI
* @ Date 2010-6-1
* @ Author Kit. Liao
* @ Copyright kingkit.com.cn
* @ Version 0.9.0
* @ Thanks: http://www.cnblogs.com/rubylouvre/archive/2009/09/16/1566699.html
* Example: fade-in: KUI. Animation. fadeIn (el); fade-in: KUI. Animation. fadeOut (el)
*/
KUI. Animation = {
FadeIn: function (id ){
This. fade (id, true );
},
FadeOut: function (id ){
This. fade (id, false );
},
Fade: function (id, flag ){
Var target = KUI. get (id );
Target. alpha = flag? ;
Target. style. opacity = (target. alpha/100 );
Target. style. filter = 'Alpha (opacity = '+ target. alpha + ')';
Var value = target. alpha;
(Function (){
Target. style. opacity = (value/1, 100 );
Target. style. filter = 'Alpha (opacity = '+ value + ')';
If (flag ){
Value ++;
If (value <= 100 ){
SetTimeout (arguments. callee, 15); // continue to call itself
}
}
Else {
Value --;
If (value> = 0 ){
SetTimeout (arguments. callee, 15); // continue to call itself
}
}
})();
}
}
Package download