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 keep a page Out of the browser history
Code to Block submission of form by pressing Enter Key
Create a ViewState Property?
program to bring a window to the front
advance the focus to next consecutive fields when Enter Key is pressed
determine which Element received an Event
How to encode and decode URL strings?
how to create an anonymous function
code to detect availability of cookies
how to pass data between pages using Frames
how to get the User's Time of Day
code to positioning of window in certain dimensions
program to show a progress bar
snippet to prevent submission of form when certain/any validations got failed
code to create a new window