-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,300
  • 5
  • 34
  • 58

2 Answers2

1

You could apply a regex to it:

if (/^\d+$/.test(payrol_no)) {
    // Just digits
} else {
    // contains non-digit characters
}
Mureinik
  • 277,661
  • 50
  • 283
  • 320
1

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

ZekeDroid
  • 6,909
  • 5
  • 28
  • 58