Click to See Complete Forum and Search --> : JavaScript Function..
Frank100
March 3rd, 2009, 04:39 PM
Hi Guys I am not good in JavaScript…
I have 3 textboxes….
I want to calculate 2Textbox values and want to show the calculate value to TextBox3 OnTextChange Event of TextBox2 …
Like..
TextBox1 = 10
TextBox2 = 20 (OnTextChange Event) (10+20)
TextBox3 = 30
Please provide me a Function and Where do I need to call this function?
Thanks..
Frank100
March 3rd, 2009, 11:27 PM
Still Waiting... :(
PeejAvery
March 4th, 2009, 07:30 AM
Did you not learn anything from the other post?
Read up on some of the examples on W3School's JavaScript examples page (http://w3schools.com/js/js_examples_3.asp). Pay special attention to the "Form and Form Input Objects" section. There are plenty examples to help you get this done.
Frank100
March 4th, 2009, 11:19 AM
I am not able to call OnTextChange Event... :(
PeejAvery
March 4th, 2009, 01:11 PM
That's because there is no JavaScript OnTextChange event...it's onchange.
http://w3schools.com/jsref/jsref_events.asp
hopefulcd
March 10th, 2009, 02:12 PM
I made up an example html file for your issue. I hope this helps...
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Calculate Test</title>
<script type="text/javascript">
function calculate()
{
var v1 = parseInt(document.getElementById('box1').value);
var v2 = parseInt(document.getElementById('box2').value);
var sum = v1 + v2;
document.getElementById('box3').value = sum;
}
</script>
</head>
<body>
<center>
<br/>
Put two numbers in the boxes. When the value of the second box changes, the sum of the two boxes will appear in the result box.
<br/><br/>
Value 1:
<input type="text" id="box1" value="" />
<br/>
Value 2:
<input type="text" id="box2" onchange="calculate()" value="" />
<br/><br/>
Result:
<input type="text" id="box3" value="" />
</center>
</body>
</html>
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.