Javascript NaN in IE but woks fine in Chrome, Firefox?

Not sure about this, but it might be worth a shot. Instead of.

Up vote 0 down vote favorite share g+ share fb share tw.

I have the following javascript code that works fine in firefox and chrome. But when I load this page in IE all the fields get filled with NaN. Any help would be appreciated var totalarray=new Array(); var totalarray2= new Array(); var runningtotal = 0; var runningtotal2 = 0; var discount = .2; var discounttotal = 0; var discount1 = 0; runningtotal = runningtotal * 1; runningtotal2 = runningtotal2 * 1; function displayResult(price,init) { var newstring = "quantity"+init; var totstring = "total"+init; var quantity = document.

GetElementById(newstring). Value; var quantity = parseFloat(quantity); var test = price * quantity; var test = test. ToFixed(2); document.

GetElementById(newstring). Value = quantity; document. GetElementById(totstring).

Value = "$" + test; totalarrayinit = test; getTotal(); } function getTotal(){ runningtotal = 0; var i=0; for (i=0;i Item      Price      Quantity      Total      $name \$$price 0123456789 " ; echo ""; $foodname = "'SESS_FOODNAME_" . $init . "'"; $foodid = "'SESS_FOODID_" .

$init. "'"; $_SESSION$foodname = $name; $_SESSION$foodid = $brId; $init = $init+1; } $_SESSION'SESS_INIT' = $init;? > Total Cost Discount Total After Discount javascript html link|improve this question edited Mar 24 at 23:14 asked Mar 24 at 21:31Zinv11.

– j08691 Mar 24 at 21:36 on the lines document. GetElementById('totalcost'). Value="$" + runningtotal.

ToFixed(2); document. GetElementById('totalcost2'). Value="$" + runningtotal2.

ToFixed(2); – Zinv Mar 24 at 21:38 ill edit my original post to include it on the bottom – Zinv Mar 24 at 21:42.

Not sure about this, but it might be worth a shot. Instead of: document. GetElementById('xxx').

Value = "$" + runningtotal2. ToFixed(2); Try: document. GetElementById('xxx').

Value = "$" + runningtotal2. ToFixed(2).toString(); Or: document. GetElementById('xxx').

Value = "$" + ( runningtotal2. ToFixed(2) + '' ); Theoretically, the + operator would give priority to its string concatenation behavior if there are conflicting types (see this post to have some examples), but with MSIE the only thing you can do is testing... a lot. Good luck ;).

Thanks for the input. I actually figured out wht the issue was. Since I was using getElementById to set the variable quantity from a drop box it was getting set to null.

To fix I had to do the following: Original var quantity = document. GetElementById(newstring). ; and change it to this: var quanttest = document.

GetElementById(newstring). SelectedIndex; var quantity = document. GetElementById(newstring).

Optionsquanttest. Text; – Zinv Mar 25 at 5:22.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions