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

After clicking on OK the button output will appear in new window:















                 Example:

                   <HTML>
                   <BODY>
                   <SCRIPT>
                   /*Accept percentage and print the remark based on it:
                   %                    Remark
                   >=80                   Excellent
                   >=60 and <80                Very Good
                   >=40 and <60                Good
                   <40                   Work Hard
                   */
                   var perc=prompt("Enter percentage");
                   document.write("Percentage entered is :"+perc);
                   document.write("<br> <br>");
                   if (perc>=80) {
                     document.write("Excellent");}
                   else if (perc>=60 && perc <80) {
                     document.write("Very Good");}
                   else if (perc>=40 && perc <60) {
                     document.write("Good");}
                   else {
                     document.write("Work Hard");}
                   </SCRIPT>
                   </BODY>
                   </HTML>
                 Output:




















                                                                      Introduction to Dynamic Websites Using JavaScript  319
   316   317   318   319   320   321   322   323   324   325   326