Share on Google+Share on Google+

HTML5 output tag, Example of <output> tag in HTML5.

Advertisement
In this section, you will see the use and implementation of <output> tag of HTML5.

HTML5 output tag, Example of <output> tag in HTML5.

In this section, we will introduce you to about the <output> tag. The output tag is used for displaying result of calculation on browser. The <output> tag is not present in HTML5. It has both start and end tag.

Attribute of option:
There are following attributes......

Attributes Value Description
name string Specify name of output element
form id Related form name.
for  id Id of one or more related field

Declaration Syntax :

Declaration syntax of <output> in HTML5.

                      <output   name=""> Text </output>

Example of <output> in HTML5:

Code:
Output_Tag.html
<!doctype html >
<html ><head>
<title>Document title.</title>
<script type="text/javascript">
function multi()
{
a=parseInt(prompt("Enter first number.",0));
b=parseInt(prompt("Enter first number.",0));
document.forms["form"]["result"].value=a*b;
}
</script></head>
<body onload="multi()">
<h1>output tag Example.</h1>
<p><b>Implementation of &lt;output &gt; in HTML5.</b></p>
<form action="roseindia.html" method="get" name="form">
<label>Multiplication of two number:</label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<output name="result">
</output> </form></body>
</html>
Output:

Download this code

Difference Between HTML5 and HTML4.01:

The <output> tag is available in both HTML5. It is not present in HTML4.01.

Advertisements

Advertisement

Posted on: September 13, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.