Page 315 - Web Applications (803) Class 11
P. 315

On running the above program, we get the following output:


















                 When you click on the “OK” button, with the message “this page says”. Then a new window opens, as shown below:














                 Example:

                   <!DOCTYPE HTML>
                   <HTML>
                   <HEAD>
                   <TITLE> if statement </TITLE>
                   </HEAD>
                   <BODY>
                   <SCRIPT>
                   var days = parseInt(prompt("How many days are there in a leap year?"));
                   if(days == 366)
                   {
                   document.write("Your answer is correct, Good Job.");
                   }
                   </SCRIPT>
                   </BODY>
                   </HTML>
                 On running the above program, we get the following output:



















                                                                      Introduction to Dynamic Websites Using JavaScript  313
   310   311   312   313   314   315   316   317   318   319   320