|
|
 |
RE: FN-FORUM: Javascript error
date posted 21st September 2007 12:38
Hi,
I'm not getting any error messages with this but it's not working
either...!
Any ideas?
Thanks
Ashley
-----Original Message-----
From: [EMAIL REMOVED] [EMAIL REMOVED] On Behalf Of Dai
Williams
Sent: 21 September 2007 13:09
To: FN-FORUM / [EMAIL REMOVED]
Subject: RE: FN-FORUM: Javascript error
ADH WebCreations wrote:
> and on the textbox I have:
>
> onclick="javascript:calcCharLeft(this);"
> onkeyup="javascript:calcCharLeft(this);"
> onchange="javascript:calcCharLeft(this);">
> Left />
>
> if (document.queryform.Summary.value.length > maxLength) { is null or
> not an object"
Since you are passing the object reference into the function it is much
cleaner, safer and more extensible to refer to it using that object
reference e.g.
function calcCharLeft(obj) {
clipped = false;
maxLength = 1000;
if (obj.value.length > maxLength) {
obj.value = obj.value.substring(0,maxLength);
charleft = 0;
clipped = true;
} else {
charleft = maxLength - obj.value.length;
}
prevsec++;
if(autoprev && prevsec > 5 && prevtxt != obj.value) {
autoPreview();
prevtxt = obj.value;
}
}
Can't comment whether that is the only issue, but it is certainly worth
a
try. Also a good idea to get in the habit of terminating statements
with ;
even when it is not an absolute requirement.
HTH,
Dai
--
Freelancers, contractors earn more with Prosperity4
Call 0870 870 4414 or visit www.prosperity4.com
and benefit from Inland Revenue approved expenses today.
To advertise here: http://www.freelancers.net/advertising.html
|
 |
|