formatnumber

1. Senior Member
Join Date
Dec 1969
Posts
306

## formatnumber

Hi all!<BR><BR>I have many textboxes where in users will enter values of weight and cost details..I am using this function below to calculate the totals of the same<BR><BR>function showTotalTwo (strH1, strH2, strH3) <BR>{ <BR> var frm = document.forms[2]; <BR> var v1 = frm.elements[strH1].value <BR> var v2 = frm.elements[strH2].value <BR> v1 = parseFloat( v1.replace( /[,\$s]/g, "" ) ); <BR> v2 = parseFloat( v2.replace( /[,\$s]/g, "" ) ); <BR><BR> if ( isNaN( v1 ) ) v1 = 0; <BR> if ( isNaN( v2 ) ) v2 = 0; <BR> <BR> frm.elements[strH1].value = v1; <BR> frm.elements[strH2].value = v2; <BR> frm.elements[strH3].value = v1+v2; <BR> <BR> showSubTotals();<BR>} <BR><BR><BR>What I want is when any user enters value like .25 instead of 0.25 that 0 should be pupulated immd on blur..<BR><BR>Pls help<BR><BR>

2. Senior Member
Join Date
Dec 1969
Posts
306

## RE: formatnumber

Hi all!<BR><BR><BR>Sorry Problem is with this function not the other one..<BR>I have many textboxes where in users will enter values of weight and cost details..I am using this function below to calculate the totals of the same<BR><BR>function showTotalOne (strH1, strH2, strH3)<BR> {<BR> if (isNaN(document.forms[2][strH1].value))<BR> document.forms[2][strH1].value = "0" ;<BR> if (isNaN(document.forms[2][strH2].value))<BR> document.forms[2][strH2].value = "0" ;<BR> <BR> document.forms[2][strH3].value = document.forms[2][strH2].value ;<BR> <BR> showSubTotals();<BR> }<BR><BR>What I want is when any user enters value like .25 instead of 0.25 that 0 should be pupulated immd on blur..<BR><BR>Pls help<BR>

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•