SofaKingGreat
Technical User
I need some help.....
I have an associative array (tenmap).
I have a form with numbered hidden fields (num_1,num_2,num_3 etc..)
I'm trying to print the values from "tenmap" based on the values num_X
the while loop checks that ten_x exists, if it does I try to print the values.
I'm trying to assign the num_X value to var tmp.
I also created tmp1 and I assign to it the same value that num_1 has (000_00).
Then I alert(tmp) and alert(tmp1), they both seems to be "000_00".
When I try to alert(tenmap[tmp]), I get "undefined", but alert(tenmap[tmp1]) prints 1 (the value from the associative array).
What am I doing wrong
TennisLessons.com - The place to go to find a pro.
MathLessons.com - When the numbers don't add up.
I have an associative array (tenmap).
I have a form with numbered hidden fields (num_1,num_2,num_3 etc..)
I'm trying to print the values from "tenmap" based on the values num_X
the while loop checks that ten_x exists, if it does I try to print the values.
I'm trying to assign the num_X value to var tmp.
I also created tmp1 and I assign to it the same value that num_1 has (000_00).
Then I alert(tmp) and alert(tmp1), they both seems to be "000_00".
When I try to alert(tenmap[tmp]), I get "undefined", but alert(tenmap[tmp1]) prints 1 (the value from the associative array).
What am I doing wrong

Code:
function sssmap()
{
var x = 1;
var tenmap = new Array();
tenmap["000_00"] = 1;
while (eval("typeof document.pb.ten_" + x + " != 'undefined'"))
{
eval("var tmp = document.pb.ten_" + x + ".value");
var tmp1 = "000_00";
alert(tmp);
alert(tmp1);
alert(tenmap[tmp]);
alert(tenmap[tmp1]);
}
x++;
}
}
TennisLessons.com - The place to go to find a pro.
MathLessons.com - When the numbers don't add up.