Use the following function to Check the object does ahve a Numeric value or not.
javascript :
function Validatenumber(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(); } } }
No comments:
Post a Comment