Open In App

How to define the result of a calculation using HTML5 ?

Last Updated : 28 May, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

In this article, we will learn how to define a result of a calculation. The <output> tag is used to representing the result of a calculation performed by the client-side script such as JavaScript. The <output> tag is a new tag in HTML5 and it requires a starting and ending tags.

Syntax:

<output> Results... </output>

Example:




<!DOCTYPE html>
<html>
  
<head>
    <title>
        Define the result 
        of a calculation
    </title>
  
    <style>
        body {
            text-align: center;
        }
  
        h1 {
            color: green;
        }
    </style>
</head>
  
<body>
    <h1>GeeksforGeeks</h1>
  
    <h2>
        HTML5: How to define the 
        result of a calculation?
    </h2>
      
    <form oninput="sumresult.value = parseInt(A.value) 
                + parseInt(B.value) + parseInt(C.value)">
        <input type="number" name="A" value="50" /> +
        <input type="range" name="B" value="0" /> +
        <input type="number" name="C" value="30" />
        <br>
        Result: <output name="sumresult"></output>
    </form>
</body>
  
</html>                


Output:

Supported Browsers:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads