
26/09/2006, 16:16
|
 | Moderador extraterrestre | | Fecha de Ingreso: diciembre-2001 Ubicación: Madrid
Mensajes: 6.987
Antigüedad: 23 años, 2 meses Puntos: 61 | |
algo así?
Código:
<html>
<head>
<title>Untitled</title>
<script>
punto=0;
var puntoEsta=-2;
function pepe(esto){
if(esto.value.charAt(esto.value.length-1)=="."){
if(punto==0){
if(esto.value.length-1==0){
esto.value="0"+esto.value;
}
punto=1;
puntoEsta=esto.value.length;
}
else{
esto.value=esto.value.substring(0,esto.value.length-1);
}
}
if(punto==1){
esto.value=esto.value.substring(0,puntoEsta+2);
if(esto.value.indexOf(".")==-1){
punto=0;
puntoEsta=null;
}}
}
</script>
</head>
<body>
<input type="text" onkeyup="pepe(this)">
</body>
</html>
__________________ Cómo escribir
No hay pregunta tonta, sino tonto que quiere seguir en la ignorancia. |