Thread: Limited Textarea
Results 1 to 5 of 5
Related
-
Limited Traffic Offer - 0.67$/1.000 visitors Forum: Internet Services
Replies: 0 -
48hr LIMITED TIME OFFER!!! 500MB + 5,000MB = $19.99/YR, 250MB + 2,500MB = $12.99/YR Forum: Internet Services
Replies: 4 -
Banner Spots available on PR5 Homepage-$5/mo limited time Forum: Internet Services
Replies: 0
-
07-03-2003, 09:11 AM #1
Limited Textarea
Hi. I wanto to limit scrolls of textarea. I con't want users type more rows than the rows declared in the <textarea rows=..>
How can i do ?
I' don't wnat to limit the number of characters, bot the rows to avoid scrolling....
Bye....thanks....
-
07-03-2003, 11:29 AM #2
-
07-05-2003, 02:20 PM #3
u can't. u CAN limit the number of chars though, using javascript.
**************************************************
<head>
<script language=Javascript>
<!--
function LimitChars()
{
var MostChars = 100;
var CurrentChars = document.FormName.testTextArea.length
if CurrentChars >= MostChars
{
document.FormName.testTextArea.disabled = true;
}
else
{
document.FormName.testTextArea.disabled = false;
}
}
-->
</script>
</head>
**************************************************
<form name="FormName">
<textarea name=testTextArea onKeyUp="LimitChars();">
Default Text
</textarea>
</form>
-
07-05-2003, 02:21 PM #4
i THINK i got the function right. ah well...
-
07-08-2003, 12:06 AM #5
Hi
I try to post my version of the solution of this task.
Head Section:
Code:<script language=Javascript> function Checker(value) { var MaxChars=document.YourForm.YourTextArea.cols * document.YourForm.YourTextArea.rows if (window.event.keyCode == 13) {document.YourForm.YourTextArea.blur();} document.YourForm.YourTextArea.value = value.substring(0, MaxChars - 1) } </script>
Code:<form name="YourForm"> <textarea rows=3 name=YourTextArea onkeypress="Checker(this.value);"></textarea> </form>
http://www.unixcities.com/dhtml/textarea/