tr0n
Jul 29th, 2002, 07:05 AM
i've got a couple of questions regarding data types in javascript:
1. i have a variable that i've declared as "var iOrders;", that's meant to hold an integer. i'm trying to increment this everytime a function is called, using "iOrders += 1;", and then in another function i want a loop that loops through the amount held in iOrders, using this:
for (i = iOrders; i > 0; i--) {
//do stuff
}
but it's saying that the value of iOrders is NaN. is there something i'm meant to do to define iOrders as an integer?
2. i have a multidimensional array which holds some product information, one of the columns being a number (although it's in a string (ie. arrProducts[1][3] = "1234"; ), because some other columns are strings. i need to compare the value of that to a number entered in a textbox, so how can i convert them both to integers? at the moment i'm using this:
if (document.form1.text1.value > arrProducts[i][3]) {
//do stuff
}
thanks for any help :)
1. i have a variable that i've declared as "var iOrders;", that's meant to hold an integer. i'm trying to increment this everytime a function is called, using "iOrders += 1;", and then in another function i want a loop that loops through the amount held in iOrders, using this:
for (i = iOrders; i > 0; i--) {
//do stuff
}
but it's saying that the value of iOrders is NaN. is there something i'm meant to do to define iOrders as an integer?
2. i have a multidimensional array which holds some product information, one of the columns being a number (although it's in a string (ie. arrProducts[1][3] = "1234"; ), because some other columns are strings. i need to compare the value of that to a number entered in a textbox, so how can i convert them both to integers? at the moment i'm using this:
if (document.form1.text1.value > arrProducts[i][3]) {
//do stuff
}
thanks for any help :)