Form Handling
- The submit button typically submits the form.
- This can submit it to the server, handle it on the client
(as below), or typically check it's ok on the client and then
submit it.
-
<form name="add" >
Numbers <input type="text" name="num1"> +
<input type="text" name="num2"> =
<input type="text" name="output">
<input type="button" name="AddButton" value="Add"
onClick="addNums()">
</form>
-
- The javascript from the header is
<script type="text/javascript">
function addNums() {
value1 = parseInt(add.num1.value);
value2 = parseInt(add.num2.value);
//alert (value1);
add.output.value = value1 + value2
return true;}
</script >