Hi,
just set the maxlength of textbox = 10 and to check that user has entered the 10 digits write following code in javascript...
[CODE=javascript]
function check()
{
if(textbox1.val ue.length!=10)
{
alert("Please Enter 10 digits for textbox1");
textbox1.focus( );
return false;
}
}
[/CODE]
Last edited by malav123; Apr 8 '08, 12:26 PM.
Reason: to set format of javascript coding
Hi,
just set the maxlength of textbox = 10 and to check that user has entered the 10 digits write following code in javascript...
[CODE=javascript]
function check()
{
if(textbox1.val ue.length!=10)
{
alert("Please Enter 10 digits for textbox1");
textbox1.focus( );
return false;
}
}
[/CODE]
that code just checks for 10 characters without checking the type of it ... so it would be possible to enter 10 alpha-chars or numbers or a mixture ... so mrhoo's (see post #2) solution is to prefer for the original requirement ...
that code just checks for 10 characters without checking the type of it ... so it would be possible to enter 10 alpha-chars or numbers or a mixture ... so mrhoo's (see post #2) solution is to prefer for the original requirement ...
kind regards
Yes you are right i have only specified for length 10, for numeric value checking "isNaN" is very useful function of javascript... right ?
Comment