validation code / function to allow only Letters in a text box
Answer / kevin konkle
//A script to format the Name field to only allow letters
//Have this be called off the keypress event of your
textbox control.
function nameFormat(fld, e)
{
var key = '';
//This string contains all characters you want to allow
//It could just as easily be 0123456789 to only allow
numbers.
var strCheck
= 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
var whichCode = (window.Event) ? e.which : e.keyCode;
if (whichCode == 13) return true; // Enter
if (whichCode == 8) return true; // Delete
// Get key value from key code
key = String.fromCharCode(whichCode);
// Not a valid key
if (strCheck.indexOf(key) == -1) return false;
//If it is a legal value then add it to the text box
fld.value += key;
return false;
}
| Is This Answer Correct ? | 21 Yes | 17 No |
code to detect availability of cookies
how to create an anonymous function
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space:
how to transform XML Data into HTML
write a program to detect the user's browser ?
how to delay a function call ?
Code to Block submission of form by pressing Enter Key
code to create a new window
Create a Menu that can be activated while clicking on Right Mouse button
code to keep a page Out of the browser history
create Drop-Down Navigation Menus
How to test whether two strings are equal or not ?