Adding numbers to text box and providing output in text box?
>> Wednesday, June 8, 2011
<html>
<SCRIPT language = JavaScript>
function calculate() {
A = document.frmOne.txtFirstNumber.value
B = document.frmOne.txtSecondNumber.value
C = (A + B)
document.frmOne.txtThirdNumber.value = C
}
</SCRIPT>
<FORM NAME = frmOne>
Number One: <INPUT TYPE = Text NAME = txtFirstNumber SIZE = 5 value ="">//enter value=5;
Number Two: <INPUT TYPE = Text NAME = txtSecondNumber SIZE = 5 value ="">//enter value=6;
<P>
Total: <INPUT TYPE = Text NAME = txtThirdNumber SIZE = 5 value = "">//we will get total as 56 when we submit the button.
<P>
<Input Type = Button NAME = b1 VALUE = "Add Numbers" onClick = calculate()>
</FORM>
</html>
<SCRIPT language = JavaScript>
function calculate() {
A = document.frmOne.txtFirstNumber.value
B = document.frmOne.txtSecondNumber.value
C = (A + B)
document.frmOne.txtThirdNumber.value = C
}
</SCRIPT>
<FORM NAME = frmOne>
Number One: <INPUT TYPE = Text NAME = txtFirstNumber SIZE = 5 value ="">//enter value=5;
Number Two: <INPUT TYPE = Text NAME = txtSecondNumber SIZE = 5 value ="">//enter value=6;
<P>
Total: <INPUT TYPE = Text NAME = txtThirdNumber SIZE = 5 value = "">//we will get total as 56 when we submit the button.
<P>
<Input Type = Button NAME = b1 VALUE = "Add Numbers" onClick = calculate()>
</FORM>
</html>
0 comments:
Post a Comment