From w3school.com:
Attributes= New in HTML5.
Attribute Value Description for element_id Specifies the relationship between the result of the calculation, and the elements used in the calculation form form_id Specifies one or more forms the output element belongs to name name Specifies a name for the output element
Sample Code ( number HTML5 input type and range HTML5 input type ):
<form oninput="amount.value = (hours.valueAsNumber * rate.valueAsNumber) + ((hours.valueAsNumber * rate.valueAsNumber) * vat.valueAsNumber)" onsubmit="return false">
<legend>Invoice</legend>
<label for="hours">Number of hours:</label>
<input id="hours" min="0" name="hours" type="range" value="5" />100
<label for="rate">Rate:</label>
<input id="rate" min="0" name="rate" type="number" value="1" />($'s)
<label for="vat">VAT:</label>
<input id="vat" min="0" name="vat" type="number" value="0.20" />
Total: <strong>$<output for="hours rate vat" name="amount"></output>
</form>
No comments:
Post a Comment