Page 360 - Webapplication11_C11_Flipbook
P. 360

Example:

                 <!DOCTYPE HTML>
                 <HTML>
                 <HEAD>

                 <TITLE> if-else statement </TITLE>
                 </HEAD>
                 <BODY>
                 <SCRIPT>
                 var a = parseInt(prompt("Enter the first number"));

                 var b = parseInt(prompt("Enter the second number"));
                 if(a > b)
                 {

                 document.write("First number is greater then second number");
                 }
                 else
                 {
                 document.write("Second number is greater then first number");

                 }
                 </SCRIPT>
                 </BODY>

                 </HTML>
              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 with “Enter the
              Second number in it”.



















                358     Touchpad Web Applications-XI
   355   356   357   358   359   360   361   362   363   364   365