@@ -22,44 +22,44 @@ written by Alf Magne Kalleland.
2222Alf Magne Kalleland, 2005
2323Owner of DHTMLgoodies.com
2424
25- ************************************************************************************************************/
26-
25+ ************************************************************************************************************/
26+
2727var currentlyActiveInputRef = false ;
2828var currentlyActiveInputClassName = false ;
2929
30- function highlightActiveInput ( )
31- {
32- if ( currentlyActiveInputRef ) {
33- currentlyActiveInputRef . className = currentlyActiveInputClassName ;
34- }
35- currentlyActiveInputClassName = this . className ;
36- this . className = 'inputHighlighted' ;
37- currentlyActiveInputRef = this ;
38-
39-
30+ function highlightActiveInput ( ) {
31+ if ( currentlyActiveInputRef ) {
32+ currentlyActiveInputRef . className = currentlyActiveInputClassName ;
33+ }
34+ currentlyActiveInputClassName = this . className ;
35+ this . className = "inputHighlighted" ;
36+ currentlyActiveInputRef = this ;
4037}
4138
42- function blurActiveInput ( )
43- {
44- this . className = currentlyActiveInputClassName ;
45-
46-
39+ function blurActiveInput ( ) {
40+ this . className = currentlyActiveInputClassName ;
4741}
4842
43+ function initInputHighlightScript ( ) {
44+ var tags = [ "INPUT" , "TEXTAREA" ] ;
4945
50- function initInputHighlightScript ( )
51- {
52- var tags = [ 'INPUT' , 'TEXTAREA' ] ;
53-
54- for ( tagCounter = 0 ; tagCounter < tags . length ; tagCounter ++ ) {
55- var inputs = document . getElementsByTagName ( tags [ tagCounter ] ) ;
56- for ( var no = 0 ; no < inputs . length ; no ++ ) {
57- if ( inputs [ no ] . className && inputs [ no ] . className == 'doNotHighlightThisInput' ) continue ;
58-
59- if ( inputs [ no ] . tagName . toLowerCase ( ) == 'textarea' || ( inputs [ no ] . tagName . toLowerCase ( ) == 'input' && inputs [ no ] . type . toLowerCase ( ) == 'text' ) ) {
60- inputs [ no ] . onfocus = highlightActiveInput ;
61- inputs [ no ] . onblur = blurActiveInput ;
62- }
63- }
64- }
65- }
46+ for ( tagCounter = 0 ; tagCounter < tags . length ; tagCounter ++ ) {
47+ var inputs = document . getElementsByTagName ( tags [ tagCounter ] ) ;
48+ for ( var no = 0 ; no < inputs . length ; no ++ ) {
49+ if (
50+ inputs [ no ] . className &&
51+ inputs [ no ] . className == "doNotHighlightThisInput"
52+ )
53+ continue ;
54+
55+ if (
56+ inputs [ no ] . tagName . toLowerCase ( ) == "textarea" ||
57+ ( inputs [ no ] . tagName . toLowerCase ( ) == "input" &&
58+ inputs [ no ] . type . toLowerCase ( ) == "text" )
59+ ) {
60+ inputs [ no ] . onfocus = highlightActiveInput ;
61+ inputs [ no ] . onblur = blurActiveInput ;
62+ }
63+ }
64+ }
65+ }
0 commit comments