|
|
 |
FN-FORUM: Javascript error
date posted 21st September 2007 11:30
Hello,
This will be a easy for you guys.
I have a textbox in a form which only allows 1000 characters and I've
seen on a forum I installed on the site a character countdown and I want
to use that for my textbox.
The javascript code is:
var noalert =3D true, gralert =3D false, rdalert =3D false, clalert =3D =
false;
var prevsec =3D 5
var prevtxt
var cntsec =3D 0
function tick() {
cntsec++
calcCharLeft()
timerID =3D setTimeout("tick()",1000)
}
var autoprev =3D false
var topicfirst =3D true;
function enabPrev() {
if ( autoprev =3D=3D false ) {
autoprev =3D true
topicfirst =3D true
document.queryform.Summary.focus();
autoPreview();
}
else {
autoprev =3D false;
ubbstr =3D '';
document.queryform.Summary.focus();
}
calcCharLeft()
}
function calcCharLeft() {
clipped =3D false
maxLength =3D 1000
if (document.queryform.Summary.value.length > maxLength) {
document.queryform.Summary.value =3D
document.queryform.Summary.value.substring(0,maxLength)
charleft =3D 0
clipped =3D true
} else {
charleft =3D maxLength - document.queryform.Summary.value.length
}
prevsec++
if(autoprev && prevsec > 5 && prevtxt !=3D
document.queryform.Summary.value) {
autoPreview()
prevtxt =3D document.queryform.Summary.value
}
}
and on the textbox I have:
Left
I understand bits of javascript but it keeps coming up with an error
saying:
if (document.queryform.Summary.value.length > maxLength) { is null or
not an object"
Can anyone help?
Kind regards
=A0
Ashley Harvey
ADH WebCreations
07967 791738
www.adhwebcreations.co.uk=20
|
 |
|