About W3school HTML5 part of the output element instance code (point to try it in person) to correct the problem

Source: Internet
Author: User

FIX: Change the original = number to <input type= "button" onclick= "Rescalc ()" value = "="/>, otherwise no event to activate JS calculation method:

Original URL: http://www.w3school.com.cn/tiy/t.asp?f=html5_form_output

<! DOCTYPE html>
<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>
<body>
<p> Simple Calculator:</p> using the output element
<form onsubmit= "return false" >
<input id= "Num_a"/> +
<input id= "Num_b"/> <input type= "button" onclick= "Rescalc ()" value = "="/>
<output id= "Result" onforminput= "Rescalc ()" ></output>
</form>

</body>

About W3school HTML5 part of the output element instance code (point to try it in person) to correct the problem

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.