Welcome to the Virtual Education Wiki ~ Open Education Wiki
Form:Test calculation form: Difference between revisions
Jump to navigation
Jump to search
(new form) |
No edit summary |
||
| Line 1: | Line 1: | ||
<form> | <form> | ||
<input name="num1" type="number" | <label for="num1">Number 1:</label> | ||
<select name=" | <input name="num1" type="number" /> | ||
<option value=" | <br> | ||
<option value=" | <label for="num2">Number 2:</label> | ||
<option value=" | <input name="num2" type="number" /> | ||
<option value=" | <br> | ||
<label for="operator">Operator:</label> | |||
<select name="operator"> | |||
<option value="+">Addition</option> | |||
<option value="-">Subtraction</option> | |||
<option value="*">Multiplication</option> | |||
<option value="/">Division</option> | |||
</select> | </select> | ||
< | <br> | ||
<input type="submit" value="Calculate" | <input type="submit" value="Calculate"> | ||
{{# | <br> | ||
| Result: | {{#ifexpr: {{{num1|0}}} AND {{{num2|0}}} | ||
{{#switch: {{{ | |Result: | ||
| | {{#switch: {{{operator}}} | ||
| | |+ = {{#expr: {{{num1}}} + {{{num2}}}}} | ||
| | |- = {{#expr: {{{num1}}} - {{{num2}}}}} | ||
| | |* = {{#expr: {{{num1}}} * {{{num2}}}}} | ||
|/ = {{#expr: {{{num1}}} / {{{num2}}}}} | |||
}} | }} | ||
}} | }} | ||
</form> | </form> | ||
Revision as of 13:42, 21 April 2023
<form>
<label for="num1">Number 1:</label> <input name="num1" type="number" />
<label for="num2">Number 2:</label> <input name="num2" type="number" />
<label for="operator">Operator:</label> <select name="operator"> <option value="+">Addition</option> <option value="-">Subtraction</option> <option value="*">Multiplication</option> <option value="/">Division</option> </select>
<input type="submit" value="Calculate">
</form>