JavaScript Error Handling

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>

Ebook Download
View all
Learn
View all