textarea limiter not working

Z

zeltus

Hi

Can some kind soul(s) review my stripped-down html below and advise me
on why it doesn't work? All I get when I enter text in the form is the
ubiquitous "Error on page" at the bottom of the browser.

For the life of me, I can't see why it doesn't work :- it's gotta be
something simple, surely?

As ever, all help gratefully received

Cheers

Bill

---------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>counter</title>

<script language="JavaScript" type="text/javascript">
<!--
function CText(CField, CCount, Climit) {
if (CField.value.length > Climit) {
CField.value = CField.value.substring(0, Climit);
} else {
CCount.value = Climit - CField.value.length;
}
}
//-->
</script>

</head>
<body>

<form method="post" action="test.html">
<textarea rows="15" name="body" cols="75" wrap="physical"
onKeyDown="CText(this.form.body,this.form.total,100);"
onKeyUp="CText(this.form.body,this.form.total,100);"></textarea>
</form>

</body>
</html>
 
L

Lee

zeltus said:
Hi

Can some kind soul(s) review my stripped-down html below and advise me
on why it doesn't work? All I get when I enter text in the form is the
ubiquitous "Error on page" at the bottom of the browser.

For the life of me, I can't see why it doesn't work :- it's gotta be
something simple, surely?

Try testing in a browser that gives useful error messages.
The Firefox Javascript console would tell you that CCount has no properties.
You don't have a field named "total".


--
 
P

parboil

Excellent! I just knew it had to be something simple (looking so hard I
couldn't see the wood for the trees - or vice versa or sumfin')

Great tip about firefox - I should indeed be using it more anyway...

Many thanks

Bill
 
E

Evertjan.

wrote on 30 mrt 2006 in comp.lang.javascript:
Excellent! I just knew it had to be something simple (looking so hard I
couldn't see the wood for the trees - or vice versa or sumfin')

Great tip about firefox - I should indeed be using it more anyway...

Please quote what you are replying to. If you want to post a followup via
groups.google.com, don't use the "Reply" link at the bottom of the article.
Click on "show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers.
<http://www.safalra.com/special/googlegroupsreply/>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,754
Messages
2,569,516
Members
44,975
Latest member
MDACVIngedients

Latest Threads

Top