Hola alsanal
Prueba esto espero que te funcione
Código HTML:
Ver original<script type="text/javascript"> function validarNum(e)
{
tecla = (document.all) ? e.keyCode : e.which;
if (tecla == 8) return true;
patron = /\d/;
te = String.fromCharCode(tecla);
return patron.test(te);
}
<input type="text" onkeypress = "return validarNum(event)" />