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
how to pass data between pages using Cookies
function to combine two or more arrays
Reading which Non-Character Key was pressed
how to create a Custom Scrollbar
program to show a progress bar
code to positioning of window in certain dimensions
how to create a Draggable element
code to detect availability of cookies
How to block double clicks
code to get the coordinates of a Click Event
how to Auto Scroll the page
how to create an anonymous function
how to transform XML Data into HTML
code to set the main window's size
sample code to auto focusing the first field in a form