Demo

Relevant code used in this demo

function SuperFieldDecorator(borderColor1,borderColor2,colorF,colorB){ this.borderFocus = borderColor1; this.borderBlur = borderColor2; this.focusColor = colorF; this.blurColor = colorB; this.init(); } // This class inherits FieldDecorator (see FieldDecorator.js) SuperFieldDecorator.prototype = new FieldDecorator(); SuperFieldDecorator.prototype.activate = function(){ if(this.style){ this.style.border = "3px solid "+this.borderFocus; this.style.backgroundColor = this.focusColor; } } SuperFieldDecorator.prototype.deactivate = function(){ if(this.style){ this.style.border = "1px solid "+this.borderBlur; this.style.backgroundColor = this.blurColor; } } // Page code: Object.registerClass("input",SuperFieldDecorator,["#550000","#005500","#FF0000","#00FF00"]);
< back