Ver Mensaje Individual
  #9 (permalink)  
Antiguo 07/05/2008, 09:49
Danarion
 
Fecha de Ingreso: mayo-2008
Mensajes: 8
Antigüedad: 16 años
Puntos: 0
Re: Socorro, ayuda al novato.

Saludos de nuevo.. he estado revisando el código con un validador y me dice que no hay fallos, ya he incluido la libreria jquery y esta en el mismo directorio.. pero voy a ejecutarlo en firefox y no me hace nada.. alguien sabe de que podria ser? este es el código:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

<html>

<head>
<title>
Calculadora Ajax
</title>



<script src="jquery-1.2.3.min.js" type="text/javascript"> </script>
<script type="text/javascript">

function validar(formu)
{
numemp = parseInt(formu.numeroEmpleados.value, 10); //convierte en valores enteros los datos del formulario (base 10)
tc1 = parseInt(formu.TC1.value, 10);
cf = parseInt(formu.CF.value, 10);

if ( isNaN(numemp) && isNaN(tc1) ) { //valida que sean numeros
alert("Debe cumplimentar los dos campos con valores numericos.");
return false;

}
if ( numemp < 0 || tc1 < 0 ) { //valida que sean positivos
alert("Los valores numericos introducidos deben ser positivos.");
return false;
//ok, envio formulario
}


if (numemp >= 6 && numemp <=9 )
{ cf = tc1 * 0.007;
alert("Credito formativo = " + cf);
return true;
}
if (numemp > 10 && numemp < 49 )
{ cf = tc1 * 0.007 * 0.075;
alert("Credito formativo = " + cf);
return true;
}
if (numemp > 50 && numemp < 249 )
{ cf = tc1 * 0.007 * 0.060;
alert("Credito formativo = " + cf);
return true;
}
if (numemp > 250 )
{ cf = tc1 * 0.007 * 0.050;
alert("Credito formativo = " + cf);
return true;
}
}

</script>

</head>

<body>


<form name="miFormu" onSubmit="return validar(this);">

<p>

<input name="numeroEmpleados" type="text" size="10"> Numero empleados<br>
<input name="TC1" type="text" size="10"> TC1<br>
<input type="submit" name="miSubmit" value="Consultar">

</p>

</form>





</body>


</html>