Ver Mensaje Individual
  #2 (permalink)  
Antiguo 09/02/2006, 04:07
Avatar de JavierB
JavierB
Colaborador
 
Fecha de Ingreso: febrero-2002
Ubicación: Madrid
Mensajes: 25.052
Antigüedad: 23 años
Puntos: 772
Hola yampoo

Prueba con esto:
Código:
<html>
<head>
<title>Untitled</title>
<script type="text/javascript">
function calcula(valor) {
  if (valor.indexOf('%')!=-1) {
    porcen = valor.substring(0,valor.length-1);
    tot = document.forms[0].numero.value * porcen / 100;
    document.forms[0].total.value = tot;
  }
}
</script>
</head>
<body>
<form>
<input type="text" onblur="calcula(this.value)" />
<input type="text" name="numero" value="1000" />
<input type="text" name="total" />
</form>
</body>
</html>
Saludos,