Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/09/2012, 18:27
Avatar de daniiable
daniiable
 
Fecha de Ingreso: noviembre-2009
Ubicación: Puebla, Pue.
Mensajes: 28
Antigüedad: 14 años, 6 meses
Puntos: 0
Pregunta Condición en input text

Hola, estoy tratando de hacer una calculadora de calorías y bueno parte del experimento consiste en que al momento de que te pases de las calorías permitidas salga una alerta en otro input text y encontré este ejemplo pero por más que le miro no corre....
El código es el siguiente:

Cita:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
</head>

<body>


<H1>BIENVENIDO A JAVASCRIPT </H1>

<B>MI SCRIPT<BR>

<FORM NAME=prog5>

SUELDO.:<INPUT TYPE=TEXT NAME=sueldo><BR>

RESULTADO..:<INPUT TYPE=TEXT NAME=resultado><BR>

<INPUT TYPE=BUTTON NAME=comparar VALUE=OK>

<script for=comparar event=onclick languaje=javascript>

var sueldo;

sueldo=parseInt( prog5.sueldo.value );

if (sueldo >= 500)

{prog5.sueldo.value= sueldo + 1000;

prog5.resultado.value= "rico";}

else

{prog5.sueldo.value= sueldo - 100;

prog5.resultado.value= "pobre";};

</script>
</FORM>


</body>
</html>
Agradeceré de antemano cualquier ayuda :D