Jump to content

Javascript not doing what i want it to do! Please help


eva21

Recommended Posts

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;

}

 

Link to comment
Share on other sites

  • 3 months later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.