i have to create two text boxes. If i fill in first text box the second textbox shoud automatically display the number of letters displayed in first text box. If the number of letters in first text box reaches 10 then an alert shoud show up saying too long. and both the text boxes shoul be reset.
[CODE=javascript]<html>
<head>
<Script language="JavaS cript">
function alll()
{
if(document.for ms[0].elements[0].value.length < 10)
{
document.forms[0].elements[1].vaule=document .forms[0].elements[0].value.length;
}
if(document.for ms[0].elements[0].value.length>= 10)
{
alert("too"+'\n '+"long");
}
}
</Script>
</head>
<body>
<form name = "f1">Enter your Message (Max is 10 characters) :
<input type = "Textbox" name = "t1" onfocus="alll() "><br>
Here is the Amount you entered :
<input type = "Textbox" name = "t2"></form>
</body>
</html>
[/CODE]
[CODE=javascript]<html>
<head>
<Script language="JavaS cript">
function alll()
{
if(document.for ms[0].elements[0].value.length < 10)
{
document.forms[0].elements[1].vaule=document .forms[0].elements[0].value.length;
}
if(document.for ms[0].elements[0].value.length>= 10)
{
alert("too"+'\n '+"long");
}
}
</Script>
</head>
<body>
<form name = "f1">Enter your Message (Max is 10 characters) :
<input type = "Textbox" name = "t1" onfocus="alll() "><br>
Here is the Amount you entered :
<input type = "Textbox" name = "t2"></form>
</body>
</html>
[/CODE]
Comment