Conver to decimal value

I have a javascript result that I need converted to a decimal.  Here is the line:

worksheet.Total.value = parseInt(Innovator) + parseInt(MktLdr) + parseInt(MajorCompetitor) + parseInt(MinorCompetitor)

Your help is appreciated.

John
LVL 1
jcpattersonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RoonaanCommented:
You mean this?

var v = parseFloat(Innovator) + parseFloat(MktLdr) + parseFloat(MajorCompetitor) + parseFloat(MinorCompetitor);
worksheet.Total.value = v.getFixed(2);

-r-
0
jcpattersonAuthor Commented:
Hello Roonaan,

Thanks for your reply.  You are onto what I am trying to do and that is converting to two decimal points.

I applied your recommendation and IE returns: Object doesn't support this property or method

Firefox debugger highlights the "worksheet.Total.value = v.getFixed(2)" line as the problem.

Here is the entire script in case you need to see it:

<script language="JavaScript">
function Scores() {

var iA1 = worksheet.A1.value
var iA2 = worksheet.A2.value
var iA3 = worksheet.A3.value
var iA4 = worksheet.A4.value  
var iB1 = worksheet.B1.value
var iB2 = worksheet.B2.value
var iB3 = worksheet.B3.value
var iB4 = worksheet.B4.value  

Innovator = parseInt(iA1) * parseInt(iB1)
MktLdr = parseInt(iA2) * parseInt(iB2)
MajorCompetitor = parseInt(iA3) * parseInt(iB3)
MinorCompetitor = parseInt(iA4) * parseInt(iB4)

var v = parseInt(Innovator) + parseInt(MktLdr) + parseInt(MajorCompetitor) + parseInt(MinorCompetitor)

 worksheet.Total.value = v.getFixed(2)
 
}
</script>

Thanks, John
0
RoonaanCommented:
Sorry, indeed it should be v.toFixed(2) rather than v.getFixed(2).

-r-
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jcpattersonAuthor Commented:
Thanks for your help on a Saturday.

John
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.