Hi,
u can try out this
-
-
<html xmlns="http://www.w3.org/1999/xhtml" >
-
<head id="Head1" runat="server">
-
<title>Untitled Page</title>
-
<script type="text/javascript">
-
function chekc()
-
{
-
-
var str = document.getElementById("text1").value;
-
alert(str.length);
-
var valid="abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ";
-
for(i=0;i<str.length;i++)
-
{
-
if(valid.indexOf(str.charAt(i)) ==-1)
-
alert("number");
-
else
-
alert("not a number");
-
}
-
-
}
-
-
</script>
-
</head>
-
<body>
-
<form id="form1" runat="server">
-
<div>
-
<input type="text" id="text1" onchange="chekc()"/>
-
</div>
-
</form>
-
</body>
-
</html>
-
Thanks for the quick reply - the code seems very advanced and im finding it hard to understand it e.g i have no clue what runat="server" means :-( ... and the problem is i need to explain it when im presenting my website.
At the moment i am only able to check that data has been entered into the field
[HTML]<script type="text/javascript">
<!--
function validate(regfor m) {
//Perform validation checks
//Check that telephone number exsit in this field
if (regform.telno. value=="") {
alert("Please complete the field: Contact number");
regform.telno.f ocus();
return false;
}
return true;
}
//-->
</script>
<form method="get" name="regform" action="regcomp lete.asp" onsubmit="retur n validate(this); ">
Contact Number:<input type="text" name="telno" size="15" />
<input type="submit" value="submit">
</form>[/HTML]