Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   javascript data type ? (http://www.chiefdelphi.com/forums/showthread.php?t=86509)

sithum 11-08-2010 05:54

javascript data type ?
 
Hi ,
I am sending a function an array of values
which contain '09' , '15','20' ,...etc
everything is working fine except when I have to do something with '09' it seems to truncate off the zero at the begining and pass to the function a 9 instead of a 09

What I want to know is how do I make the function interpert the value as 09 it seems to be converting the parameter to a number instead of the string value '09'

array[0] = '09';
array[1] = '15';
..etc

Thanks for any help

RyanCahoon 11-08-2010 17:38

Re: javascript data type ?
 
sithum,
can you give more detail about what you're trying to do with the values?

I tried your example:

Code:

<html>
<body>
<script type="text/javascript">
var arr = new Array();
arr[0] = '09';
arr[1] = '15';
arr[2] = '20';
for(var i in arr)
  document.write(arr[i]+'<br/>');
</script>
</body>
</html>

which seems to render fine as
Code:

09
15
20

--Ryan


All times are GMT -5. The time now is 09:36.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi