Got it...works nicely now, with the line uncommented!

Thanks again, I sure do appreciate it.

rgds
Paul

Jason Johnston wrote:
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to