Demo
Relevant code used in this demo
// Class FieldDecorator
function FieldDecorator(colorF,colorB){
this.focusColor = colorF;
this.blurColor = colorB;
this.init();
}
FieldDecorator.prototype.init = function(){
this.onfocus = this.activate;
this.onblur = this.deactivate;
this.deactivate();
}
FieldDecorator.prototype.activate = function(){
if(this.style){
this.style.backgroundColor = this.focusColor;
}
}
FieldDecorator.prototype.deactivate = function(){
if(this.style){
this.style.backgroundColor = this.blurColor;
}
}
// Page code:
Object.registerClass("input",FieldDecorator,["#FF0000","#00FF00"]);
< back