|
|
 |
RE: FN-FORUM: Javascript error
date posted 21st September 2007 12:30
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
|
 |
|