![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
07/06/2010, 10:39
|
| | Fecha de Ingreso: octubre-2007
Mensajes: 8
Antigüedad: 17 años, 3 meses Puntos: 0 | |
Respuesta: generar tabla en div con el numero de líneas de un campo Hola, gracias por tu atención y ayuda.
Me ha funcionado, gracias a tus sugerencias, con este script:
<script>
function tabla_div(elemento){
num = elemento.value;
hijo ="<table width='500' border='1' >";
for (i=1; i<=num; i++){
hijo +="<tr><td>a</td></tr>";
}
hijo += "</table>";
document.getElementById('tabla').innerHTML = hijo;
}
</script>
<form name="form1" method="post" action="">
<input name="numero" id="numero" type="text" size="2" maxlength="2" onChange="tabla_div(this)">
<div id="tabla">
</div>
</form>
¿Cómo se haría por DOM y cuáles son sus ventajas? |