mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-03-28 17:42:57 +01:00
in some user section *.tpl and many admin section *.tpl handle FORM elements with a behaviour (inputfix.htc) in IE the behaviour sets onfocus and onblur events too (no longer needed in *.tpl) other browsers use css selector :focus and [type=___] git-svn-id: http://piwigo.org/svn/trunk@1491 68402e56-0260-453c-a942-63ccdbb3a9ee
44 lines
908 B
Plaintext
44 lines
908 B
Plaintext
<public:attach event="oncontentready" onevent="fixElements()" />
|
|
|
|
<script langage=javascript>
|
|
|
|
function setFocusStyle()
|
|
{
|
|
this.className += ' focus';
|
|
}
|
|
|
|
function setBlurStyle()
|
|
{
|
|
this.className = this.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.onfocus = setFocusStyle;
|
|
elem.onblur = setBlurStyle;
|
|
}
|
|
break;
|
|
case "SELECT":
|
|
case "TEXTAREA":
|
|
elem.onfocus = setFocusStyle;
|
|
elem.onblur = setBlurStyle;
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|