eva21 Posted November 27, 2008 Share Posted November 27, 2008 I have a textbox for example: <input type=text size="6" MAXLENGTH="6" id="txt1" onchange="doCalcCost()" name="txt1" value=""> There is like 6 of them....the user types in a 3, and the doCalcCost function is activated and makes the number 3 a $3.00. What i want to do after all 6 of them have decimal places, i want to put in my total text box the total where i do calculations, but it doesnt work. Please help if(txt1) { txt2 = txt1.toFixed(2); document.getElementById("txt1").value = "$" + txt2; } if(txt1 && txt2 && txt3 && txt4 && txt5) { var total = 0; var cents = 0; .....calculations //put it back into the total document.getElementById("totalCost").va... = "$" + total2; } Quote Link to comment Share on other sites More sharing options...
cleary1981 Posted November 27, 2008 Share Posted November 27, 2008 Do you get an error or anything? What Happens? Quote Link to comment Share on other sites More sharing options...
eva21 Posted November 27, 2008 Author Share Posted November 27, 2008 It doesnt update the total textbox. When all the 6 textboxes have been entered, and made into a decimal(toFixed) like 3.00, i want to do my calculations, and throw the value into the total textbox. But it wont work. Quote Link to comment Share on other sites More sharing options...
eva21 Posted November 27, 2008 Author Share Posted November 27, 2008 not really sure on how to do this. Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted March 1, 2009 Share Posted March 1, 2009 Fixed: if(txt1) { txt2 = txt1.toFixed(2); document.getElementById("txt1").value = "$" + txt2; } if(txt1 && txt2 && txt3 && txt4 && txt5) { var total = 0; var cents = 0; document.getElementById("totalCost").va = "$" + total2; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.