Page 363 - Webapplication11_C11_Flipbook
P. 363

Example:

                   <HTML>
                   <BODY>
                   <SCRIPT>
                   var num1=prompt("Enter first number");

                   var num2=prompt("Enter second number");
                   document.write("Numbers entered :"+num1+","+num2);
                   document.write("<BR> <BR>");
                   if (num1!=num2) {
                     document.write("Numbers are not equal");}

                   else if(num1>num2) {
                     document.write(num1+" is greater than "+num2);}
                   else if(num2>num1) {
                     document.write(num2+" is greater than "+num2);}

                   else {
                     document.write("Both numbers are equal");}
                   </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 appears as” Enter second
                 number”





















                                                                                                  JavaScript Part 1  361
   358   359   360   361   362   363   364   365   366   367   368