Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] How can i strict the length of TextAread form element ?
- From: javascript@xxxxxxxxxx (Manuel Socarras Reyes)
- Subject: [Javascript] How can i strict the length of TextAread form element ?
- Date: Mon, 24 Dec 2001 16:09:19 +0100
something like this should work, specially if you don't want the user typing
more chars than allowed
--
Saludos,
Manuel Socarrás Reyes <msocarras@xxxxxxxx>
Barcelona. Spain
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script>
function restrictLenght(field, countfield, maxlimit) {
if (field.value.length > maxlimit)
field.value = field.value.substring(0, maxlimit);
else
countfield.value = maxlimit - field.value.length;
}
</script>
</head>
<body bgcolor="#FFFFFF">
<form name="comments">
<p>Type your comments:</p>
<p>
<textarea cols=40 name="typed" rows=3 " wrap="virtual"
onKeyDown="restrictLenght(comments.typed,comments.left,120);" >
</textarea>
</p>
<p>
<input type="text" name="left" value="120">
</p>
</form>
</body>
</html>
"M. Amin" wrote:
> Dear All,
> I tried to strict the length of TextAread form element using the
> maxlength attribute but
> it did n't work. So, How can i strict the length of TextAread form element ?
>
> Any help will be appreciated,
>
> Regards,
> M. Amin
>
> _______________________________________________
> Javascript mailing list
> Javascript@xxxxxxxxxx
> https://lists.LaTech.edu/mailman/listinfo/javascript
- References:
- Prev by Date: [Javascript] window.open doesn't work with IE4.5 Mac
- Next by Date: [Javascript] server-side js
- Previous by thread: [Javascript] How can i strict the length of TextAread form element ?
- Next by thread: [Javascript] what is the maximum for a drop down box...I stuff it with 4418 it ems
- Index(es):