<html>
<head>
<script type="text/javascript">
<!--
var validNums = '0123456789.()+- ';
var validLetters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ -';
function validateKeyPress(e, validSet)
{
var key;
var keychar;
if(window.event || !e.which) // IE
key = e.keyCode; // IE
else if(e)
key = e.which; // Netscape
else
return true; // no validation
keychar = String.fromCharCode(key);
validSet += String.fromCharCode(8);
if (validSet.indexOf(keychar) < 0)
return false;
return true;
}
//-->
</script>
</head>
<body>
<form name="myForm">
<input type="text" size="50" onKeyPress="return validateKeyPress(event, validLetters)" />
</form>
</body>
</html>
No comments:
Post a Comment