Código HTML:
function esInteger(e){
var charCode
if (navigator.appName == "Netscape")
{
charCode = e.which
}
else
{
charCode = e.keyCode
}
if (charCode < 48 || charCode > 57)
{
alert("Por favor teclee solo números en este campo!");
return false;
}
else
{
return true;
}
}
Código HTML:
<td><input name="txtdiab" type="text" id="txtdiab" size="2" maxlength="2" value="<?php echo $diab;?>" keypress="return esInteger(txtdiab)"> <span class="Estilo9">/ <input name="txtmesb" type="text" id="txtmesb" size="2" maxlength="2" value="<?php echo $mesb;?>" keypress="return esInteger(txtmesb)"> /</span> <input name="txtanob" type="text" id="txtanob" size="4" maxlength="4" value="<?php echo $anob;?>" keypress="return esInteger(txtanob)">