Ver Mensaje Individual
  #3 (permalink)  
Antiguo 20/08/2004, 10:06
Avatar de KarlanKas
KarlanKas
Moderador extraterrestre
 
Fecha de Ingreso: diciembre-2001
Ubicación: Madrid
Mensajes: 6.987
Antigüedad: 23 años, 1 mes
Puntos: 61
Prueba con esto. Es un ejemplillo hecho a mano de lo que será tu página. Con el script te servirá con cualquiera:
Código HTML:
<html>
<head>
	<title>Untitled</title>
	<script>
function suma(este,formulario){
	if(!isNaN(formulario.elements[este].value)){
		nombre=este.split("-")[0];
		var total=0;
		for(a=1;a<32;a++){
			aa=(a<10)?"0"+a:a;
			nombre2=nombre+"-"+aa;
			valor=Number(formulario.elements[nombre2].value);
			total+=valor;
		}
		formulario.elements[nombre+"-total"].value=total;
	}
	else{
	formulario.elements[este].value=""
	}
}
	</script>
</head>

<body>
<form name="formulario">

<table>
<tr>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="123456789N-01" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="123456789N-02" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="123456789N-03" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="123456789N-04" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="123456789N-05" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="123456789N-06" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="123456789N-07" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="123456789N-08" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="123456789N-09" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="123456789N-10" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="123456789N-11" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="123456789N-12" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="123456789N-13" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="123456789N-14" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="123456789N-15" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="123456789N-16" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="123456789N-17" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="123456789N-18" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="123456789N-19" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="123456789N-20" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="123456789N-21" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="123456789N-22" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="123456789N-23" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="123456789N-24" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="123456789N-25" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="123456789N-26" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="123456789N-27" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="123456789N-28" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="123456789N-29" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="123456789N-30" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="123456789N-31" /></td>
</tr>
<tr><td colspan="5">Total:<input tyle="text" name="123456789N-total" readonly="readonly" /></td></tr>
</table>

<table>
<tr>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="333333333P-01" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="333333333P-02" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="333333333P-03" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="333333333P-04" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="333333333P-05" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="333333333P-06" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="333333333P-07" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="333333333P-08" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="333333333P-09" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="333333333P-10" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="333333333P-11" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="333333333P-12" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="333333333P-13" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="333333333P-14" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="333333333P-15" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="333333333P-16" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="333333333P-17" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="333333333P-18" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="333333333P-19" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="333333333P-20" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="333333333P-21" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="333333333P-22" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="333333333P-23" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="333333333P-24" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="333333333P-25" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="333333333P-26" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="333333333P-27" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="333333333P-28" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="333333333P-29" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="333333333P-30" /></td>
<td><input type="text" size="2" maxlength="2" onKeyUp="suma(this.name,this.form)" name="333333333P-31" /></td>
</tr>
<tr><td colspan="5">Total:<input tyle="text" name="333333333P-total" readonly="readonly" /></td></tr>
</table>

</form>


</body>
</html> 
Un saludo
__________________
Cómo escribir

No hay pregunta tonta, sino tonto que quiere seguir en la ignorancia.