vediamo

html
Codice PHP:
<form name="form">
<
input type="text" name="testo">
<
form
js
Codice PHP:
function checkFields() {
    if (
testo && !isNaN(Number(testo)) && typeof testo != 'boolean') {
        return;
            } else {
                
alert('Devi inserire un numero, fagiano!!');
        }
}

function 
init() {
    var 
testo document.form.testo;
    
testo.onblur checkFields(testo);
}

window.onload init
non l'ho testato..