Hola, altraun.
Prueba este código:
Código PHP:
<html>
<head>
<script>
function validar(e){
tecla = (document.all) ? e.keyCode : e.which;
if ((tecla<48 || tecla>57) && tecla!=46 && tecla!=44) return false
}
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<input type="text" name="textfield" onKeyPress="return validar(event)">
</body>
</html>
Saludos,