By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,581 Members | 1,966 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,581 IT Pros & Developers. It's quick & easy.

Javascript validation code for textbox on press event

P: 18
Can anybody say me for writing javascript code for textbox key press event such a way that it should allow only alphabets,dot and spaces
Mar 22 '07 #1
Share this Question
Share on Google+
6 Replies


100+
P: 117
this can help you. http://www.thescripts.com/forum/thread148144.html
Mar 22 '07 #2

100+
P: 117
and also check this http://www.merlyn.demon.co.uk/js-valid.htm
Mar 22 '07 #3

100+
P: 117
and this http://www.thescripts.com/forum/thread149058.html
Mar 22 '07 #4

P: 5
Hi,

If you wanna Regular exp, i can help you.
Can i have your requirement.

Chinna
Mar 22 '07 #5

P: 18
Hi,

If you wanna Regular exp, i can help you.
Can i have your requirement.

Chinna
i have return java script code for textbox ...this is code...it allows only aphabets...but i wat to allow space and dot....wat will be the code.....


<script>
function EnsureNumeric()
{
var a = window.event.keyCode;
//alert(a);
if((a >= 97 && a <= 122) || (a >= 65 && a <= 90))
return true;
else
return false;
//alert(window.event.keyCode);
//a = 97; z = 122; A= 65; Z= 90
}
</script>
<body>
<input type="text" name="test" onkeypress="return EnsureNumeric();">
</body>
Mar 23 '07 #6

P: 19
Can anybody say me for writing javascript code for textbox key press event such a way that it should allow only alphabets,dot and spaces


write in the reguler exp validator
following expression
\w+
Mar 23 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.