...

View Full Version : Q about behaviour of even hanlders when error occurs



SFL
03-09-2005, 05:46 PM
Hi all,

I'm new to client side coding so please be patient : )

If I register an onClick() handler as usual like this:


onClick="if (document.form0.loc.value == ''){alert('Message...');} doSomething();}"


if doSomething() errors out (due to invalid variable name etc.), what would be the return value or what would it be evaluated as?

From a piece of code I have tested in firefox and IE I get different behaviour. IE goes ahead with the default event handler while firefox halts all JS execution for that onClick event.

Is this normal? Does anyone know of a good resource for a comparison of IE and W3C compliant browsers?

Thanks for taking the time to read this!

/SFL

hemebond
03-09-2005, 09:26 PM
if doSomething() errors out (due to invalid variable name etc.), what would be the return value or what would it be evaluated as?When you click, Firefox should show an alert window, then call doSomething. If there's something wrong in doSomething, like an error, execution would stop unless you have provided appropriate error handling (try...catch statement for instance).

SFL
03-09-2005, 10:13 PM
Thanks for the quick reply hemebond!

Very much appreciated!

The behaviour you describe is exactly what I get. While I'm glad to know Firefox is behaving as it should I'm still wondering if it's normal for IE NOT to stop execution?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum