Esta es mi aportacion, dependiendo de tus requisitos pudiera modificarla ampliamente:
Código HTML:
<input type="text" id="numero">
<script type="text/javascript">
function numerosEnterosTelefono(e) {
var e = e || window.event;
var code = e.which || e.keyCode;
var character = String.fromCharCode(code);
if (code === 116 || code === 17 || code === 37 || code === 39 || code === 8 || code === 9 || code === 13 || code === 27 || code === 46 || /\d/.test(character)) {
return true;
}
else {
return false;
}
}
document.getElementById('numero').onkeypress = numerosEnterosTelefono;
</script>