지금까지 사용해 왔지만 제대로 작동하지 않습니까?연령 확인 자바 스크립트
//if no age was entered it will allow
var age=document.getElementById('age1').value;
if(age == "")
return true;
//check if age is a number or less than or greater than 100
if (isNaN(age)||age<1||age>100)
{
alert("The age must be a number between 1 and 100");
return false;
}
단지 유효성을 검사해야합니다 !!!!
좋은 제안을하지만 당신은보다 구체적인 정규 표현식 패턴을 제공 할 것입니다. 'donotmatch100','donotmatch10or0'과'donotmatch10or0orme'에 대해서 여러분의 정규식을 시험해보십시오. –
Thnks @ Tanzel Kazi, 대답을 업데이트했습니다 –
대단합니다. :) –