<html lang="en">
<body>
<H1 id="H1"></H1>
<input type="button" id="button1" onclick="myFunction()" value="Click Me">

<script>
    function ShowMessage()
    {
        try{
            abcalert("Hello World");
        }
        catch(err){
            document.getElementById("H1").innerHTML=err.message;
        }
        finally{
            var num1, num2, result;
            num1=10;
            num2=20;
            result=num1+num2;
            alert("The Sum is " + result);
        }
    }
    function myFunction()
    {
        var num1="ABC";
        try{
            if(num1=="") { throw "Blank not allowed"; }
            if(isNaN(num1)) { throw "Value not a Number"; }
            if(num1<5) { throw "Value is less than 5"; }
            if(num1>50) { throw "Value is greater than 50"; }
        }
        catch(err)
        {
            document.getElementById("H1").innerHTML=err;
        }
    }
</script>
</body>
</html>