Ver Mensaje Individual
  #6 (permalink)  
Antiguo 26/06/2007, 15:04
trepafi
 
Fecha de Ingreso: octubre-2006
Ubicación: Madrid, Spain
Mensajes: 2
Antigüedad: 18 años, 4 meses
Puntos: 0
Re: ¡No me asigna valores a mi arreglo!

Tengo un problema con el siguiente script, no muestra nada cuando la recursividad va de regreso :S... llevo todo un día probando diferentes alternativas y llenandolo de alerts y nada.

Agradezco de antemano la ayuda...

<script>
items = [ ["Principal", "principal.php" , ["Usuarios", "user.php", "#"],["Base de Datos", "user.php", "#"]],["Principal", "principal.php" , Usuarios", "user.php", "#"], ["Base de Datos", "bd.php", "#"]]];

function ver()
{
res = "";
for (var i = 0; i < items.length; i++)
{
res+= "<b>Item " + i + ":</b><br>";
res+= verItem(items[i]);
}
document.getElementById('resul').innerHTML = res;
}

function verItem(it)
{
res = "";
res+= "Tamaño '"+ it.length +"'<br>";
res+= "Nombre: '" + it[0] + "'<br>";
res+= "Link: '" + it[1] + "'<br>";

for(j=2; j< it.length; j++)
{
res+= "<br>Hijo " + (j-1) + "de " + (it.length-2)+": " + it[j]+ "<br>";
if(it[j]!="#")
res+= verItem(it[j]);
}

res+="<br>Sale del for<br>";
//alert(res)
return res;
}
</script>

<table width="327" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="150" height="38">&nbsp;</td>
<td width="161">&nbsp;</td>
<td width="16">&nbsp;</td>
</tr>
<tr>
<td height="24"></td>
<td valign="top">
<form id="form1" name="form1" method="post" action="">
<input type="button" name="Submit" value="Ver" onclick="ver();"/><br>
</form>
</td>
<td></td>
</tr>
<tr>
<td height="16"></td>
<td></td>
<td></td>
</tr>
</table>
<div id="resul">
</div>