validation code / function to allow only NUmbers in a text box
Answer Posted / shwetha kamath
function validate_user_editadvanced_form_username(element)
{var valid = "0123456789"
var ok = "yes";
var temp;
for (var i=0; i<element.value.length; i++) {
temp = "" + element.value.substring(i, i+1);
if (valid.indexOf(temp) == "-1") ok = "no";
}
if (ok == "no") {
alert("Invalid entry! Only numbers are accepted!");
element.focus();
element.select();
}
}
Is This Answer Correct ? | 9 Yes | 1 No |
Post New Answer View All Answers
code to sorting an array of objects
Create a Menu that can be activated while clicking on Right Mouse button
how to create Expandable and Collapsible Menus
code to detect versions of different browsers like internet explorer, netscape, mozilla, opera etc
how to convert between arrays and strings
how to Scroll a DIV content
write a code to generate pseudorandom numbes
code to create a new window
how to Auto Scroll the page
create Drop-Down Navigation Menus
snippet to prevent submission of form when certain/any validations got failed
How to encode and decode URL strings?
code to Hide and Show form controls
How to block double clicks
Create a ViewState Property?