Saturday, 14 September 2024

WRITE A JAVASCRIPT TO DISPLAY MONTH NAME USING PROMPT

 

CODE :-

<html>

                <head>               

                                <title>Month</title>

                                <script type="text/javascript">

                                                function check()

                                                {

                                                                var no=parseInt(prompt("Enter Number="));

                                                               

                                                                if(no==1)

                                                                {

                                                                                alert("January");

                                                                }

                                                                else if(no==2)

                                                                {

                                                                                alert("February");

                                                                }

                                                                else if(no==3)

                                                                {

                                                                                alert("March");

                                                                }

                                                                else if(no==4)

                                                                {

                                                                                alert("April");

                                                                }

                                                                else if(no==5)

                                                                {

                                                                                alert("May");

                                                                }

                                                                else if(no==6)

                                                                {

                                                                                alert("June");

                                                                }

                                                                else if(no==7)

                                                                {

                                                                                alert("July");

                                                                }

                                                                else if(no==8)

                                                                {

                                                                                alert("August");

                                                                }

                                                                else if(no==9)

                                                                {

                                                                                alert("September");

                                                                }

                                                                else if(no==10)

                                                                {

                                                                                alert("October");

                                                                }

                                                                else if(no==11)

                                                                {

                                                                                alert("November");

                                                                }

                                                                else if(no==12)

                                                                {

                                                                                alert("December");

                                                                }

                                                                else

                                                                {

                                                                                alert("Invalid Choice");

                                                                }

                                                }

                                </script>

                                </head>

                                <body>

                                                <form name="form1" method="post" onsubmit="return check()">

                                                                <input type="submit" name="submit" value="Submit">

                                                </form>

                                </body>

</html>

               

No comments:

Post a Comment