Creating a HTML 5 page using "output" tag

The HTML <output> tag is used for displaying or showing the result of a calculation or operation, such as one performed by a script.
The <output> tag was first introduced in HTML 5.
This walkthrough will guide you on how to create an HTML 5 page which can multiply two numbers. It can also be useful for creating the first HTML 5 page for many beginners.
  • First of all open a new text document.
  • Paste the following code in it.
  1. <!doctype html ><html ><head><title>Document title.</title>
  1. undefined</head>undefined<body onload="multi()">
  2. <h1>output tag Example.</h1>
  3. <p>
  4. <b>Implementation of <output > in HTML5.</b>
  5. </p>
  6. <form action="roseindia.html" method="get" name="form">
  7. <label>Multiplication of two number:</label>
  8. <output name="result"></output>
  9. </form>undefined</body>undefined</html>
  • Now paste the following javascript code between the </title> and </head> tags.
    1. < script type = "text/javascript" >
    2. function multi() {
    3. a = parseInt(prompt("Enter first number.", 0));
    4. b = parseInt(prompt("Enter first number.", 0));
    5. document.forms["form"]["result"].value = a * b;
    6. } <
    7. /script>
  • Now save the page as "First program.html".
Now you are ready to test your page by opening it (double-clicking it).