Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

parseFloat in a French browser

Status
Not open for further replies.

jm99

Programmer
Jun 14, 2001
27
0
0
GB
Hi Guys

I'm trying to establish if non-English browsers have a different implementation of parseFloat(). For example, if I enter 1,30 into a French installation of IE 5 will this be parsed as one dollar thirty cents or one dollar?

I've changed the regional settings of my Windows 2k installation and changed the language settings in IE itself so that fr_FR is at the top of the list but the return of parseFloat() continues to be what I'd expect in an English environment, (i.e. one dollar for 1,30).

Does this mean that I need to parse the String 1,30 and replace the ',' with a '.' before passing it to parseFloat()?

Perhaps somebody with a non-English European installation of IE/Windows could try the experiment for me, (just in case this is something that is set at installation). Could you try running this and tell me if the result is 3 or 3.3?

<html>
<head>
<script>
<!--
function testParse(){
var a = '1,3';
alert(parseFloat(a)+2);
}
-->
</head>
<body>
<input type=button value='Click Me' onclick='testParse();'>
</body>

I realise that there is an internationalization forum on this site but there is virtually no activity there which is why I'm posting this question here.

Thanks in advance

J
 
Sorry guys, I missed the closing script tag on the last post

<html>
<head>
<script>
<!--
function testParse(){
var a = '1,3';
alert(parseFloat(a)+2);
}
-->
</script>
</head>
<body>
<input type=button value='Click Me' onclick='testParse();'>
</body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top