[Javascript] String -> Number impossible

diego nunes dnunes at gmail.com
Tue Aug 22 05:50:46 CDT 2006


On 8/22/06, Marcelo Wolfgang <grillo at gmail.com> wrote:
> array_prices = new Array();
> array_prices[1] = '115'; //these values are coming from a db
> array_prices[2] = '95';

     Can you chance the server side script? Try using...
array_prices=['poin',
  115,
  95
];

    And, even if it doens't work, you can use "+var" notation to
convert it to number. Try something like this:

>     total = +total +(+array_prices[i]) *(2);]
>
> (...)
>
>         rdVal = +getCheckedValue(document.frm_calcShipping.valFrete);
>         if (rdVal != 0) { total = total+rdVal; }


  Amplexos.


--
diego nunes
dnunes.com



More information about the Javascript mailing list