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
Reading which Non-Character Key was pressed
Create a ViewState Property?
code to keep a page Out of the browser history
code to create a new window
function to combine two or more arrays
how to create a Draggable element
determine which Element received an Event
write a code that user can choose/alter Body Text Size
write a code to generate pseudorandom numbes
Code to Block submission of form by pressing Enter Key
How to block double clicks
program to show a progress bar
maximizing the main window
code to sorting an array of objects
how to get the User's Time of Day