Hmm, try:

if (field.value.length > parseInt(maxlimit, 10)) // if too long...trim it!

If this doesn't work, blame Netscape!

-----Original Message-----
From: Deanna Schneider [mailto:[EMAIL PROTECTED]]
Sent: July 25, 2001 3:11 PM
To: CF-Talk
Subject: OT: javascript driving me crazy


Hi folks,
I know this is offtopic, but since it's keeping me from getting other CF
stuff done....

I'm using a bit o' javascript to countdown the characters in a textarea.
It looks like so:
In the head:
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
countfield.value = maxlimit - field.value.length;
}
In the form:
<textarea name=message wrap=physical cols=28 rows=10
onKeyDown="textCounter(this.form.message,this.form.remLen,125);"
onKeyUp="textCounter(this.form.message,this.form.remLen,125);"></textarea>
<br>
<input readonly type=text name=remLen size=3 maxlength=3 value="125">
characters left</font>

If I go beyond 28 columns, it doesn't work in Netscape. What's up with that?
This is really supposed to be a 3000 character limit, but that doesn't work
so well with only 28 columns. Ideas?

Deanna Schneider
Interactive Media Developer
[EMAIL PROTECTED]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to