Blog

JavaScript Error Handling

Posted by Sreejesh SP Blogs | JavaScript Aug 20, 2013
This blog defines try, catch in JavaScript.

Below code use error handling in js.   

function Navigate() {

        try {

            addlert("Welcome guest!");

        }

        catch (err) {

            txt = "There was an error on this page.\n\n";

            txt += "Error description: " + err.message + "\n\n";

            txt += "Click OK to continue.\n\n";

            alert(txt);

        }

    }

</script>

<body>

    <form id="form1" runat="server">

    <div>

        <%-- <asp button type="button" onclick="alert('Welcome!')">Click Me!</button>--%>

        <asp:Button ID="Button1" Text="Open Web site" OnClientClick="Navigate()" runat="server" />        

    </div>

    </form>

COMMENT USING
PREMIUM SPONSORS
Hire Mobile & Web Developer on demand. 100% satisfaction. Try for 1 week or Money Back. Local and remote developers available all over USA.
SPONSORED BY
  • MCN is your source for developing solutions involving websites, mobile apps, cloud-computing, databases, BI, back-end services and processes and client-server applications.