js tryCatch.html

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>tryCatch</title>
    <script>

        function message() {
            try {
                adddlert("Welcome guest!");
            } catch (err) {
                let txt = "";
                txt = "there is an error page \ n \ n.";
                txt + = "Error Description:" + err.message + "\ n \ n";
                txt + = "Click OK to continue \ n \ n.";
                alert(txt);
            }
        }
    </script>
</head>
<body>
<input type="button" value="查看消息" onclick="message()"/>
</body>
</html>

Guess you like

Origin blog.csdn.net/weixin_42193179/article/details/90904795