Last change
on this file since 4324 was
3282,
checked in by plg, 16 years ago
|
change: according to topic:15067, svn:keywords property was removed
|
-
Property svn:eol-style set to
LF
|
File size:
1.0 KB
|
Line | |
---|
1 | <public:attach event="oncontentready" onevent="fixElements()" /> |
---|
2 | |
---|
3 | <script langage=javascript> |
---|
4 | |
---|
5 | function setFocusStyle() |
---|
6 | { |
---|
7 | window.event.srcElement.className += ' focus'; |
---|
8 | } |
---|
9 | |
---|
10 | function setBlurStyle() |
---|
11 | { |
---|
12 | window.event.srcElement.className = window.event.srcElement.className.replace( ' focus', ' nofocus'); |
---|
13 | } |
---|
14 | |
---|
15 | function setClassFromType() |
---|
16 | { |
---|
17 | this.className += ' ' + this.type; |
---|
18 | } |
---|
19 | |
---|
20 | function fixElements() |
---|
21 | { |
---|
22 | for ( var i=0; i<this.elements.length; i++ ) |
---|
23 | { |
---|
24 | var elem=this.elements[i]; |
---|
25 | switch ( elem.tagName ) |
---|
26 | { |
---|
27 | case "INPUT": |
---|
28 | elem.className += ' ' + elem.type; |
---|
29 | if ( (elem.type != "radio") && (elem.type != "checkbox") ) |
---|
30 | { /* setting focus/nofocus on those is a mess to handle in css */ |
---|
31 | elem.attachEvent( 'onfocus', setFocusStyle ); |
---|
32 | elem.attachEvent( 'onblur', setBlurStyle ); |
---|
33 | } |
---|
34 | break; |
---|
35 | case "SELECT": |
---|
36 | case "TEXTAREA": |
---|
37 | elem.attachEvent( 'onfocus', setFocusStyle ); |
---|
38 | elem.attachEvent( 'onblur', setBlurStyle ); |
---|
39 | } |
---|
40 | } |
---|
41 | } |
---|
42 | </script> |
---|
Note: See
TracBrowser
for help on using the repository browser.