
21/09/2004, 10:46
|
 | Moderador extraterrestre | | Fecha de Ingreso: diciembre-2001 Ubicación: Madrid
Mensajes: 6.987
Antigüedad: 23 años, 2 meses Puntos: 61 | |
He acortado un poco el tamaño del código: Código HTML: <html>
<head>
<title>Untitled</title>
<script language="javascript">
<!--
otro=0;
function LP_data(){
var key=window.event.keyCode;//codigo de tecla.
if (key < 48 || key > 57){//si no es numero
window.event.keyCode=0;//anula la entrada de texto.
}}
function anade(esto){
anadir=(esto.value.length>otro)?'+="-"':'=esto.value.substring(0,esto.value.length-1)'
if(esto.value.length==3 || esto.value.length==7){
eval('esto.value'+anadir);
}
otro=esto.value.length
}
-->
</script>
</head>
<body>
<form>
<input type="text" maxlength="12" onkeypress="LP_data();anade(this)">
</form>
</body>
</html> Ahora está bien!
__________________ Cómo escribir
No hay pregunta tonta, sino tonto que quiere seguir en la ignorancia. |