![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
But if I have text, is there an easy way to lookup the other columns in this kind of table? |
#3
| ||||
| ||||
|
|
"Fabian" <lajzar (AT) hotmail (DOT) com> schreef in bericht news:bokemu$1f2n90$2 (AT) ID-174912 (DOT) news.uni-berlin.de... But if I have text, is there an easy way to lookup the other columns in this kind of table? // Note that I have removed the last comma in the definition of redraw |
|
var redraw = [ [0, 0, 1, "north"], [1, 1, 1, "north east"], [2, 1, 0, "east"], [3, 1,-1, "south east"], [4, 0,-1, "south"], [5,-1,-1, "south west"], [6,-1, 0, "west"], [7,-1, 1, "north west"] ]; function findRow(text) { for (var i = 0; i < redraw.length; i++) { if (redraw[i][redraw[i].length-1] == text) |
|
return redraw[i]; |
|
} return false; } |
#4
| |||
| |||
|
|
With teh following table, it is easy to convert from a number row reference to text d = redraw[row][3] But if I have text, is there an easy way to lookup the other columns in this kind of table? |
#5
| |||
| |||
|
|
In the specific case of this table, can I replace that line above with the following and have the same effect: if (redraw[i][3] == text) |
|
Presumably, if I know the exact column I want from the table, I can use instead: return redraw[i][ column_number ] |
![]() |
| Thread Tools | |
| Display Modes | |
| |