How do I stop javascript execution?

Discussion in 'Javascript' started by Ralphz, Sep 19, 2007.

  1. Ralphz

    Ralphz Guest

    Hi

    How do I stop JavaScript execution when I encounter an error?

    Is there something similar to PHP's exit or die function?

    Thanks
    Ralph
     
    Ralphz, Sep 19, 2007
    #1
    1. Advertising

  2. Ralphz wrote:
    > How do I stop JavaScript execution when I encounter an error?
    >
    > Is there something similar to PHP's exit or die function?


    When will using Google become a school subject? [psf 6.2]

    We had that exact same question only a few days ago, and a couple of good
    answers to it.

    http://jibbering.com/faq/


    PointedEars
    --
    Prototype.js was written by people who don't know javascript for people
    who don't know javascript. People who don't know javascript are not
    the best source of advice on designing systems that use javascript.
    -- Richard Cornford, cljs, <f806at$ail$1$>
     
    Thomas 'PointedEars' Lahn, Sep 19, 2007
    #2
    1. Advertising

  3. [Fullquote intended]

    Ralphz wrote:
    > Thomas 'PointedEars' Lahn wrote:
    >> Ralphz wrote:
    >>> How do I stop JavaScript execution when I encounter an error?
    >>>
    >>> Is there something similar to PHP's exit or die function?

    >> When will using Google become a school subject? [psf 6.2]
    >>
    >> We had that exact same question only a few days ago, and a couple of good
    >> answers to it.
    >>
    >> http://jibbering.com/faq/

    >
    > Thanks for response.
    >
    > I was actually trying to find something on the newsgroup and google. All
    > I have found is was something about using break or return. Return does
    > not work for me because i don't want to check if all the functions
    > return false. especially if i want to stop execution in function deep
    > down in call stack. Break on the other hand looks weird :)


    You missed the part about exceptions.


    PointedEars
    --
    var bugRiddenCrashPronePieceOfJunk = (
    navigator.userAgent.indexOf('MSIE 5') != -1
    && navigator.userAgent.indexOf('Mac') != -1
    ) // Plone, register_function.js:16
     
    Thomas 'PointedEars' Lahn, Sep 19, 2007
    #3
  4. Ralphz wrote:
    > Hi
    >
    > How do I stop JavaScript execution when I encounter an error?
    >
    > Is there something similar to PHP's exit or die function?
    >
    > Thanks
    > Ralph

    alert("error message") works well for me.
    For debugging.
     
    The Natural Philosopher, Sep 19, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jack Wright
    Replies:
    1
    Views:
    978
    Jack Wright
    Feb 22, 2004
  2. Jack Wright
    Replies:
    2
    Views:
    6,930
    yeswanthi
    May 28, 2007
  3. Gopal Krish

    Stop further execution in Page_Load

    Gopal Krish, Oct 24, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    13,011
    Gopal Krish
    Oct 25, 2004
  4. TS
    Replies:
    2
    Views:
    4,288
    Steven Cheng[MSFT]
    Jan 23, 2006
  5. howa

    Stop Javascript execution safely?

    howa, Sep 6, 2007, in forum: Javascript
    Replies:
    5
    Views:
    139
    Thomas 'PointedEars' Lahn
    Sep 7, 2007
Loading...

Share This Page