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 transform XML Data into HTML
how to create an anonymous function
communication between main window and new windows
maximizing the main window
Code to Block submission of form by pressing Enter Key
Create a ViewState Property?
snippet to prevent submission of form when certain/any validations got failed
code to images to rollover
determine which Element received an Event
how to create a Custom Scrollbar
how to create a Draggable element
how to pass data between pages using Cookies
create Drop-Down Navigation Menus
How to encode and decode URL strings?
how to get the User's Time of Day