1.

Which tag is used for representing the result of a calculation? Explain its attributes.

Answer»

The <output> tag is used for representing the RESULT of a calculation. It has the following attributes:

  • for - It defines the relationship between the elements used in calculation and result.
  • form - This is used to define the form the output ELEMENT belongs to.
  • name - The name of the output element.
<form oninput = "result.value=parseInt(n1.value)+parseInt(n2.value)"> <input type = "NUMBER" name = "n1" value = "1" /> + <input type = "number" name = "n2" value = "2" /><br /> The output is: <output name = "result"></output></form>

The above EXAMPLE looks like



Discussion

No Comment Found