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());

--Paul

Jason Johnston wrote:
On 11/07/2008 09:52 AM, Paul Joseph wrote:
element.attachEvent( 'on' + type, handler );

is giving me a runtime type mismatch error in IE7.

What does it do really. When I comment it out, things seem to continue
to work ;-)

It is the IE-proprietary event attachment method. See http://msdn.microsoft.com/en-us/library/ms536343(VS.85).aspx

Without it, IE won't attach any event listener, so I'm surprised you say it works while commented out. Especially since it's in an 'else' block... that just doesn't make sense.

I don't know what the type mismatch error is about. Can you paste your code so we can take a look? IE's error reporting is notoriously unreliable so it may be something else entirely.

---------------------------------------------------------------------
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