From c8a07e4c0b9d0f36f7fb73ac8af0cff64ff3fdee Mon Sep 17 00:00:00 2001 From: rvelices Date: Wed, 15 Nov 2006 02:16:30 +0000 Subject: 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 --- template-common/inputfix.htc | 13 ++++++------- 1 file 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 ); } } } - -- cgit v1.2.3