diff options
author | chrisaga <chrisaga@piwigo.org> | 2006-07-22 09:21:40 +0000 |
---|---|---|
committer | chrisaga <chrisaga@piwigo.org> | 2006-07-22 09:21:40 +0000 |
commit | e3c4d79f5be8d732185c151f9ac84ff0ddb51166 (patch) | |
tree | 192dd18d159e705c5998dda7a8f09ad15fce1112 /template-common | |
parent | a15839b18305b53d9767dd58ae03b1e6d690ac67 (diff) |
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
Diffstat (limited to '')
-rw-r--r-- | template-common/inputfix.htc | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/template-common/inputfix.htc b/template-common/inputfix.htc new file mode 100644 index 000000000..b7593293c --- /dev/null +++ b/template-common/inputfix.htc @@ -0,0 +1,43 @@ +<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> + |