Created
September 22, 2015 11:18
-
-
Save Zillionx/de746816bbce0c4ac9c7 to your computer and use it in GitHub Desktop.
Sum two fields
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Sum Form</title> | |
<script> | |
function startCalc(){ | |
interval = setInterval("calc()",1); | |
} | |
function calc(){ | |
one = document.SumForm.firstBox.value; | |
two = document.SumForm.secondBox.value; | |
document.SumForm.thirdBox.value = (one * 1) + (two * 1); | |
} | |
function stopCalc(){ | |
clearInterval(interval); | |
} | |
</script> | |
</head> | |
<body> | |
<form name="SumForm"> | |
<input type=text name="firstBox" value="" onFocus="startCalc();" | |
onBlur="stopCalc();"> + <input type=text name="secondBox" value="" onFocus="startCalc();" | |
onBlur="stopCalc();"> = <input type=text name="thirdBox"> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment