Files
Piwigo/template-common/inputfix.htc
chrisaga e3c4d79f5b fix bugs 244: different display of checkbox in IE/firefox and 484: Missing onfocus/onblur
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
2006-07-22 09:21:40 +00:00

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>