View Single Post
Old 04-24-2008, 09:14 AM   PM User | #1
ash.h
New to the CF scene

 
Join Date: Apr 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
ash.h is an unknown quantity at this point
Unhappy i am new at js and i need help so bad

hi guys how you are ?hope u doin good.
as i said i am new at js and i don't now how to creat a code that control the textbox so it accepts only english alphabits
i made a code but i didn't work well .
it just check the first index .
please help me with this .
here it is :



<script language="javascript">
function checked()
{
var str =new String();
var m;
var x;
str=f1.t1.value;
for(var i=0 ;i<=str.length ;i++)
{
m=str.charCodeAt(i);
if(m>=97 && m<=122)
x=1;
else{
x=0;
break;
}
}
if (x==1)
return true;
else
alert("the input value is only english");
return false;

}
</script>
<form name="f1" action="" Onsubmit="return checked()">
<input type="text" name="t1">
<input type="submit">
ash.h is offline   Reply With Quote