diff options
author | rvelices <rv-github@modusoptimus.com> | 2006-11-15 02:16:30 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2006-11-15 02:16:30 +0000 |
commit | c8a07e4c0b9d0f36f7fb73ac8af0cff64ff3fdee (patch) | |
tree | fde3a51219d522567d2774467cd94c80d1b184c7 | |
parent | 651ed1a626958e8f3769771f77db004bcd24c56a (diff) |
fix potential incompatibility with events directly in the template
(use attachEvent instead of onfocus)
git-svn-id: http://piwigo.org/svn/trunk@1608 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r-- | template-common/inputfix.htc | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/template-common/inputfix.htc b/template-common/inputfix.htc index b7593293c..e99d2b2c7 100644 --- a/template-common/inputfix.htc +++ b/template-common/inputfix.htc @@ -4,12 +4,12 @@ function setFocusStyle() { - this.className += ' focus'; + window.event.srcElement.className += ' focus'; } function setBlurStyle() { - this.className = this.className.replace( ' focus', ' nofocus'); + window.event.srcElement.className = window.event.srcElement.className.replace( ' focus', ' nofocus'); } function setClassFromType() @@ -28,16 +28,15 @@ function fixElements() 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; + elem.attachEvent( 'onfocus', setFocusStyle ); + elem.attachEvent( 'onblur', setBlurStyle ); } break; case "SELECT": case "TEXTAREA": - elem.onfocus = setFocusStyle; - elem.onblur = setBlurStyle; + elem.attachEvent( 'onfocus', setFocusStyle ); + elem.attachEvent( 'onblur', setBlurStyle ); } } } </script> - |