The following code used to validate "Year" using javascript.
Javascript :
function ValidateYear(obj) { if (obj.length !=0) { var text = /^[0-9]+$/; if ((document.getElementById(obj.id).value != "") && (!text.test(document.getElementById(obj.id).value))) { alert("Please Enter Numeric Values Only"); obj.focus(); obj.select(); } if (document.getElementById(obj.id).value.length>4) { alert("Year is not proper. Please check"); obj.focus(); obj.select(); } } }
No comments:
Post a Comment