-1
if  (!Character.isDigit(payroll_no))

{

   document.getElementById('field_117219').value ='We do not have your payroll number please email it to us')

}

else

 {

    Name = document.getElementById('field_115676').value;

    document.getElementById('field_117219').value ="Appraisal Details for "+Name;

     iframe_115667.location.replace('/sorce/apps/enh/asp/Appraisals.aspxgridname=Appraisals&Payroll_no='+Payroll_no);


}
Zee
  • 8,420
  • 5
  • 36
  • 58

2 Answers2

1

You could apply a regex to it:

if (/^\d+$/.test(payrol_no)) {
    // Just digits
} else {
    // contains non-digit characters
}
Mureinik
  • 297,002
  • 52
  • 306
  • 350
1

Just use isNaN(payrol_no). It returns false if it is a number (hence the "is Not A Number"), and true otherwise.

ZekeDroid
  • 7,089
  • 5
  • 33
  • 59