java4all@1986 java. Powered by Blogger.

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>

0 comments:

Post a Comment

FaceBook Login

HTML/JAVASCRIPT

HTML/JAVASCRIPT

HTML/JAVASCRIPT

HTML/JAVASCRIPT

Total Pageviews

STATCOUNTER

  © Blogger template Simple n' Sweet by Ourblogtemplates.com 2009

Back to TOP