Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    SFL
    SFL is offline
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Q about behaviour of even hanlders when error occurs

    Hi all,

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

    If I register an onClick() handler as usual like this:
    Code:
    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

  • #2
    Senior Coder
    Join Date
    Jul 2004
    Location
    New Zealand
    Posts
    1,315
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by SFL
    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).
    Forget style. Code to semantics. Seperate style from structure, and structure from behaviour.
    I code to specs, and test only in Firefox (unless stated otherwise).

  • #3
    SFL
    SFL is offline
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question One down...

    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?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •