[prototype] adding input:focus functionality to ie
1 Event.observe(window, 'load', function() { 2 var fields = $$("input"); 3 for (var i = 0; i fields[i].onfocus = function() {this.className += ' focused';} 4 fields[i].onblur = function() {this.className = this.className.replace('focused', '');} 5 } 6 }); 7 8 // in css, paste 9 // input:focus, /* works in FF without javascript */ 10 // input.focused /* used by js */ 11 // { background-color: #f7cd72; }
created by leozera —
18 November 2008 —
get a short url
— tags:
hack
ie6
javascript
prototype
—
embed