|
-
Apr 21st, 2005, 01:27 PM
#1
Thread Starter
New Member
formatting problem with math in javascript.
I am creating a very simple calculator for a web page. basically it is (entered value - entered value * 4) and (entered value + entered value * 4).
the first (subtraction) works, but the second (addition) does not format properly and returnes both values as strings joined together (ex. 1.2340.525).
This function works:
function externalmax(){
if (maxafterpitch.value=="") maxafterpitch.value="0";
if (maxthickness.value=="") maxthickness.value="0";
var pinum=(maxafterpitch.value-(maxthickness.value*4))
show("The Maximum Suggested PrePlate Pitch Diameter Is:<br><input type=text size=20 value="+pinum+">. ");
}
this function does not work:
function internalmin(){
if (mindiameter2.value=="") mindiameter2.value="0";
if (maxthickness2.value=="") maxthickness2.value="0";
var pinum=((maxthickness2.value*4)+mindiameter2.value);
show("The Minimum Suggested PrePlate Pitch Diameter is:<br><input type=text size=20 value="+pinum+">. ");
}
(returns: 0.002.02500)
Is there a method to format math values returned in javascript?
Thanks for any help.
MP
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|