I created a Date field and with the Javascript function I am masking it to date, but how to use only numbers and not text?
function mascaraData( campo, e )
{
var kC = (document.all) ? event.keyCode : e.keyCode;
var data = campo.value;
if( kC!=8 && kC!=46 )
{
if( data.length==2 )
{
campo.value = data += '/';
}
else if( data.length==5 )
{
campo.value = data += '/';
}
else
campo.value = data;
}
}
<html>
<head>
<title>Mascara data formulario</title>
</head>
<body>
<form>
<input type="text" name="outra_data" id="outra_data" maxlength="10" onkeypress="mascaraData( this, event )" />
</form>
</body>
</html>