View Full Version : Textfield value + Textfield value = Other textfield value

09-17-2011, 10:53 PM
Hey folks, I have a little problem here, I have two textfield and a botton

Text fields:

<input name="rate" type="hidden" id="rate" value="<%= rs_rating.Fields.Item("rate").Value %>" />

<input name="plus" type="hidden" id="plus" value="1" />

<input name="total" type="hidden" id="total" />

<input type="Submit" name="Submit" id="Submit" value="Course Rating " />

Now what I want is something like this input "rate" value + input "plus" value which means if for example if rate (with dynamic value which could be any number) is 4 it will be 4+1 (1 is the static value of input "plus") which will be 5 and that 5 would be the value of input "total" that is the only text field which submit to DB. Just need the JS for that math problem.

Thanks folks.

09-17-2011, 11:08 PM
<input type="button" value="Go!" onclick="myFunction()">
<input type="text" id="rate" value ="">
<input type="text" id="plus" value ="">
<input type="text" id="total" value ="">

function myFunction () {
document.getElementById("total").value = parseFloat(document.getElementById("rate").value) + parseFloat(document.getElementById("plus").value)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum