Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JavaScript Calculation 1

Status
Not open for further replies.

cdumigan

MIS
Feb 5, 2002
16
0
0
IE
Hi,
I am trying to write a javascript function that will take the numbers inputted into text boxes, multiply them, and display the result in a third text box.
For example, I have two text boxes, v_tech_imp and v_tech_imp_prob, and I want to create a function that will multiply these two values and display the result in a third text box called v_composite_impact. Ideally I would also like to have this happen without the need to click a button i.e. dynamically.
I am having great difficulty in doing this, so any help would be greatly appreciated. Thanks a million in advance,
C
 
Try this out:


<script language=&quot;javascript&quot;>

function multiply()
{
var results = document.form1.v_tech_imp.value * document.form1.v_tech_imp_prob.value;
document.form1.v_composite_impact.value=results;
}
</script>

<form name=form1>

<input type=text name=v_tech_imp onChange=&quot;javascript:multiply();&quot;>
<br>
<input type=text name=v_tech_imp_prob onChange=&quot;javascript:multiply();&quot;>
<br>
<input type=text name=v_composite_impact>
 
This is fantastic. Thanks a million for your help!!
Regards,
C
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top