OK, so as it stands now, here is how i'm calling this -
[PHP]echo '<input type="checkbox" name="check_men uid[]" value="'.$row['id'].'" onclick="getChi ldren('.$row['id'].',menuArray)" />'.str_repeat(' ยป  ;', $level-1).$row['menu_name'];[/PHP]
then, the function get children is (I need to pass the array as well, right?) -
[CODE=javascript]function getChildren(id, menu) {
var children = [];
for (var i=0;i < menu.length; i++) {
var parentid = menu[i];
if (parentid == id) {
children.push(i );
children.concat (getChildren(i) );
}
}
alert(dump(chil dren));
return children;
}[/CODE]
In FF error console, I'm getting "menu has no properties" when a menu contains other level/s below, and an empty alert box when it's a menu with no child ... hmmm ...
[PHP]echo '<input type="checkbox" name="check_men uid[]" value="'.$row['id'].'" onclick="getChi ldren('.$row['id'].',menuArray)" />'.str_repeat(' ยป  ;', $level-1).$row['menu_name'];[/PHP]
then, the function get children is (I need to pass the array as well, right?) -
[CODE=javascript]function getChildren(id, menu) {
var children = [];
for (var i=0;i < menu.length; i++) {
var parentid = menu[i];
if (parentid == id) {
children.push(i );
children.concat (getChildren(i) );
}
}
alert(dump(chil dren));
return children;
}[/CODE]
In FF error console, I'm getting "menu has no properties" when a menu contains other level/s below, and an empty alert box when it's a menu with no child ... hmmm ...
Comment