Lionel
01-10-2002, 06:21 AM
Well, I do not pretend this to be a hack, nor do I know if someone else has done it. I found it somewhere and thought that it could be useful to some.
In newthread template find:
<textarea name="message" rows="20" cols="$textareacols" wrap="virtual" tabindex="2">$message</textarea>
and replace with:
<textarea name="message" rows="20" cols="$textareacols" wrap="virtual" tabindex="2" onkeypress="compter(this.form)">$message</textarea><input type="text" name="nbcar" size=3>
then Set the var max= to your config in the script below and place the javascript anywhere between <body> and </body>
<SCRIPT LANGUAGE="JavaScript">
var max=2000;
function compter(f) {
var txt=f.message.value;
var nb=txt.length;
if (nb>=0) {
nb=nb+1;
}
if (nb>max) {
alert("Can't have more than "+max+" characters in your post");
f.message.value=txt.substring(0,max);
nb=max;
}
f.nbcar.value=nb;
}
function timer() {
compter(document.forms["form1"]);
setTimeout("timer()",100);
}
</SCRIPT>
Use it for the other templates too.
In newthread template find:
<textarea name="message" rows="20" cols="$textareacols" wrap="virtual" tabindex="2">$message</textarea>
and replace with:
<textarea name="message" rows="20" cols="$textareacols" wrap="virtual" tabindex="2" onkeypress="compter(this.form)">$message</textarea><input type="text" name="nbcar" size=3>
then Set the var max= to your config in the script below and place the javascript anywhere between <body> and </body>
<SCRIPT LANGUAGE="JavaScript">
var max=2000;
function compter(f) {
var txt=f.message.value;
var nb=txt.length;
if (nb>=0) {
nb=nb+1;
}
if (nb>max) {
alert("Can't have more than "+max+" characters in your post");
f.message.value=txt.substring(0,max);
nb=max;
}
f.nbcar.value=nb;
}
function timer() {
compter(document.forms["form1"]);
setTimeout("timer()",100);
}
</SCRIPT>
Use it for the other templates too.