hi friends,
The thing it should not allow the special characters in the email address.
When u try to enter the special character it user should feel that special character
Will not allow that is character should be vhown and remove..
I have done the total functionality but when I try to enter the spl char at the middle of the
It is removing the remaining all characters. If remove the comment at line # 32
It is giving functionality like when we type the special characters more than one
By pressing the shift button it is removing only first character..
Note :----- i am calling this function in onkeyup
function CheckValidity(textarea)
{
//alert("key--------"+window.event.keyCode);
var key;
var keychar;
if (window.event)
key = window.event.keyCode;
else if (event)
{
key = event.which;
}
else
return true;
keychar = String.fromCharCode(key);
keychar = keychar.toLowerCase();
var allowedChars = "abcdefghijklmnopqrstuvwxyz1234567890@,_.";
//var notAllowedChars = "~`!#$%^&*()+=|\\\"\/';:?";
if((allowedChars.indexOf(keychar) > -1) || key == 13 ){
return ;
}
else {
var temp = textarea.value ;
for(i=0;i<temp.length;i++){
var tempkeychar = temp.charAt(i).toLowerCase();
if(! (allowedChars.indexOf(tempkeychar) > -1 )){
// alert("after charecter----"+notAllowedChars.indexOf(tempkeychar));
// for(j=0;j<tempkeychar.length;j++){
document.forms[0].email.value = temp.substr(0,i)//+temp.substr(i+1,temp.length);
//}
//alert("before charecter----"+temp.substr(0,i));
return;
}
}
}
}