Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 72 - 2612_Digimind
P. 72

    SOME MORE PROGRAMS

                      Program 1. To print your name using JavaScript

                      <!DOCTYPE HTML>
                      <HTML>
                      <HEAD>
                      <TITLE> Print Your Name </TITLE>
                      </HEAD>
                      <BODY>
                      <SCRIPT TYPE="text/javascript">
                      var a = prompt("Enter Your Name");
                      document.write("Your name is ");
                      document.write(a);
                      </SCRIPT>
                      </BODY>
                      </HTML>

                      Program 2. To calculate the multiplication of two numbers using JavaScript

                      <!DOCTYPE HTML>
                      <HTML>
                      <HEAD>
                      <TITLE> Multiplication </TITLE>

                      </HEAD>
                      <BODY>
                      <SCRIPT type="text/javascript">

                      var a = parseInt(prompt("Enter first number: "));
                      var b = parseInt(prompt("Enter second number: "));
                      var c;
                      c = a * b;

                      document.write("The multiplication is: ");
                      document.write(c);
                      </SCRIPT>

                       70   Premium Edition-VIII

| 67 68 69 70 71 72 73 74 75 76 77 |