cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Johnston <jjohns...@apache.org>
Subject Re: bug with double-listbox?
Date Sun, 09 Nov 2008 14:50:42 GMT
On 11/09/2008 07:41 AM, Paul Joseph wrote:
> well...the code below seems to work fine on IE7.  IF I uncomment out the
> line, I get the mis-match error.
> :
> function addEvent( element, type, handler ) {
> if( element.addEventListener ) {
> element.addEventListener( type, handler, false );
> } else {
> //this line is commented out as it appears to cause a mis-match error in
> IE7
> //element.attachEvent( 'on' + type, handler );
> }
> }
>
> function myFunction1() {alert ("loaded 1")};
> function myFunction1() {alert ("loaded 1")};
>
> addEvent(window, 'load', myFunction1());
> addEvent(window, 'load', myFunction2());

These last two lines are your problem.  There should be no parentheses 
after the function names, because that executes them immediately rather 
than passing their pointers to the addEvent function.

Should be:

addEvent(window, 'load', myFunction1);
addEvent(window, 'load', myFunction2);

IE was throwing the error because instead of passing a function to 
attachEvent you were passing the result of executing your functions, 
which is void.  Hence the type mismatch.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message