Ver Mensaje Individual
  #1 (permalink)  
Antiguo 01/03/2003, 07:46
Avatar de batvampire
batvampire
 
Fecha de Ingreso: noviembre-2002
Mensajes: 87
Antigüedad: 21 años, 6 meses
Puntos: 0
Formularios+Javascript(urgente)

Tengo este codigo:


Código PHP:
<html>
<
head>

<
script>

function 
validar(textoe) {
if (
navigator.appName == "Netscape"tecla e.which;
else 
tecla e.keyCode;
if (
tecla 48 && tecla 58) return true;
if (
tecla 45 && tecla 47) return true;
if (
tecla == || tecla == 8) return true;
return 
false;
}
</script>

<script>
function chequeo() {
if (document.forms[0].da1.value == "") {
    alert("No debe dejar valores en blanco");
    document.forms[0].da1.focus();
    return;
    }
if (document.forms[0].da2.value == "") {
    alert("No debe dejar valores en blanco");
    document.forms[0].da2.focus();
    return;
    }
document.forms[0].submit();
}
</script>




</head>
<body>
<form action='javascript:alert("correcto")'>
<input type="text" name="da1" onkeypress= "return validar(this.value, event)" size="1" maxlength="3"><BR>
<input type="text" name="da2" onkeypress= "return validar(this.value, event)" size="1" maxlength="3"><BR>
<input type="button" onclick="chequeo()" name="Submit" value="Continuar" >
</form>
</body>
</html> 



este codigo funciona bien para esos inputs,pero como lo aplico a un input de este estilo,en el q utilizo php?


Código PHP:
<form method="post" action="dinamica2.php">

            <?for($i=0;$i<$uni+1;++$i){?> 
            <tr> <?for($j=0;$j<$esta;++$j){?> 

                <center>
                  <input type="text" name="da3[<?echo $i?>][<?echo $j?>]" value="" size="4" maxlength="4" onkeypress= "return validar(this.value, event)" size="1" maxlength="1">
                </center>

              <?}?> 
            <?}?> 
   
  <div align="center">
<input type="button" onclick="chequeo()" name="Submit" value="Continuar" >
</div>
 </form>
__________________
:pirata: