blob: e99d2b2c7d3f81eba9b60fb9739b75d6ca9acfa1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
<public:attach event="oncontentready" onevent="fixElements()" />
<script langage=javascript>
function setFocusStyle()
{
window.event.srcElement.className += ' focus';
}
function setBlurStyle()
{
window.event.srcElement.className = window.event.srcElement.className.replace( ' focus', ' nofocus');
}
function setClassFromType()
{
this.className += ' ' + this.type;
}
function fixElements()
{
for ( var i=0; i<this.elements.length; i++ )
{
var elem=this.elements[i];
switch ( elem.tagName )
{
case "INPUT":
elem.className += ' ' + elem.type;
if ( (elem.type != "radio") && (elem.type != "checkbox") )
{ /* setting focus/nofocus on those is a mess to handle in css */
elem.attachEvent( 'onfocus', setFocusStyle );
elem.attachEvent( 'onblur', setBlurStyle );
}
break;
case "SELECT":
case "TEXTAREA":
elem.attachEvent( 'onfocus', setFocusStyle );
elem.attachEvent( 'onblur', setBlurStyle );
}
}
}
</script>
|