
28/07/2010, 04:08
|
| | Fecha de Ingreso: junio-2010
Mensajes: 76
Antigüedad: 14 años, 9 meses Puntos: 2 | |
Respuesta: Añadir textbox segun numero Retocado, no se si es esto lo que quieres, he quitado la parte de control, eso te lo dejo a ti.
Ahora mismo si pones cualquier numero te hara esa cantidad de textbox en lista.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script type=text/javascript>
function revisa(valor, fil)
{
/*var valido=0
for (var i = 0; i < valor.length; i++) {
var caracter = valor.substring(i, i+1)
if (caracter != "0" && caracter != "1" && caracter != "2" && caracter != "3" && caracter != "4" && caracter != "5" && caracter != "6" && caracter != "7" && caracter != "8" && caracter != "9")
{
alert("Solo estan permitidos los numeros enteros")
valido++
}
}
if( valor>100)
{valido++}
if(valido>0)
{document.inicio.cantidad.value=""}
else*/
{
document.getElementById('lista').innerHTML='';
for( j=1; j<=valor; j++)
{
document.getElementById('lista').innerHTML+='<li>< input type="text"></li>';
}
}
}
</script>
</head>
<body>
<form name="inicio" action="" method="post">
<label for "cantidad">Escriba la cantidad de datos a agregar: </label>
<input type="text" name="cantidad" >
<input type="button" name="acepta" value="Aceptar" onclick="revisa(cantidad.value, this)">
<ul id="lista"></ul>
<h5>(Enteros entre 1 y 100)</h5>
</form>
</body>
</html> |