views:

30

answers:

1

Hi again , today i have a simple an understable problem for me . Next code:

alphavar = $('#frontcolour').css('opacity');
console.debug(alphavar+' '+parseFloat(alphavar));

It runs ok width Firefox and width Opera ( now all perfect :) ) , but chrome i dont know why it doesnt parse it ok : here the answer of the debug send for me (the second line of the code)

0,568966 0

The real value is 0.568966 , but chrome it seems to round it also being parseFloat not parseInt. Any idea?

Thx in advance .

+2  A: 

The string has a comma instead of a period: "0,568966" instead of "0.568966". Perhaps Firefox and Opera adjust the workings of parseFloat to deal with locale variation, but apparently Chrome does not.

Pointy
Perfect , thx for all :D . This is the way: alphavar=alphavar.replace(',','.');
Angelus