PDA

View Full Version : simpla add variables question



.:®:.
June 17th, 2003, 01:43 AM
Okies, i am doing something very stupid 8] , i have 2 input variable fields.
When i press the button to add them, it won't add together, instead it places the variables from both fields next to each other.
Finalcost is the field which shows the total amount. totalcost & totalcost2 are the input fields.
here is the code,

on(release){
_root.mailer.finalcost = ("$") + Number(_root.totalcost+_root.totalcost2);
}


any ideas??? :nerd:

Jubba
June 17th, 2003, 01:45 AM
on(release){
cost = _root.totalcost + _root.totalcost2;
_root.mailer.finalcost = "$" + cost;
}

that should work, I think...

.:®:.
June 17th, 2003, 01:51 AM
hey Jubba!
Thanks for ya speedy reply,
tried but still puts totalcost2 after totalcost, and doesn't add..

Strange, ....

Jubba
June 17th, 2003, 01:55 AM
try



on(release){
cost = Number(_root.totalcost) + Number(_root.totalcost2);
_root.mailer.finalcost = "$" + cost;
}


that might work...

.:®:.
June 17th, 2003, 01:58 AM
Thanks a heap JUBBA
Knew i was being stupid... =)
Once again u help the cause!.

thanks a bunch!

* Sends Jubba virtual keg!