source: branches/branch-1_6/template-common/inputfix.htc @ 1499

Last change on this file since 1499 was 1499, checked in by rvelices, 18 years ago

fix: missing file from r1492 (was merge r1490:1491)

  • Property svn:eol-style set to native
File size: 908 bytes
Line 
1<public:attach event="oncontentready"  onevent="fixElements()" />
2
3<script langage=javascript>
4
5function setFocusStyle()
6{
7  this.className += ' focus';
8}
9
10function setBlurStyle()
11{
12  this.className = this.className.replace( ' focus', ' nofocus');
13}
14
15function setClassFromType()
16{
17  this.className += ' ' + this.type;
18}
19
20function 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.onfocus = setFocusStyle;
32          elem.onblur = setBlurStyle;
33        }
34      break;
35      case "SELECT":
36      case "TEXTAREA":
37        elem.onfocus = setFocusStyle;
38        elem.onblur = setBlurStyle;
39    }
40  }
41}
42</script>
43
Note: See TracBrowser for help on using the repository browser.