Home >Web Front-end >HTML Tutorial >What is the use of the output tag in html5?

What is the use of the output tag in html5?

黄舟
黄舟Original
2017-07-03 10:41:233496browse

In W3C, he uses an output tag, but there is nothing after it. Then onforminput is the event that occurs when the form obtains and fills in the data. What does the form obtain the data? When does it obtain the data, the Javascript event called will assign the value to the output. But the output cannot be output. How can I output it to this tag?

<!DOCTYPE HTML>
<html>
<head>
<script type="text/javascript">
function resCalc()
{
numA=document.getElementById("num_a").value;
numB=document.getElementById("num_b").value;
document.getElementById("result").value=Number(numA)+Number(numB);
}
</script>
</head>
<body>
<p>使用 output 元素的简易计算器:</p>
<form onsubmit="return false">
 <input id="num_a" /> +
 <input id="num_b" /> =
 <output id="result" onforminput="resCalc()"></output>
</form>

</body>
</html>

Result;

What is the use of the output tag in html5?

##html5 has output and onforminput, but the browser does not support it. You must know that not all browsers implement the html5 standard, only Opera 10 is supported. I originally wanted to take a screenshot for you to see, but it seems that it cannot be uploaded. Then you can refer to the "The Authoritative Guide to HTML.5 and CSS.3", which mentions the


problem. On the onforminput attribute, delete it

and then add oninput="resCalc()" in

, the example will work. As for why onforminput fails, as a beginner, I I still don’t understand it very well, I hope some experts can add to it.

The above is the detailed content of What is the use of the output tag in html5?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn