multiline text box word count onBlur thing
by Rob Prentice <RJP(at)clickdms.com>
|
| Date: |
Tue, 25 Jul 2000 16:03:52 +0100 |
| To: |
HWG Techniques <hwg-techniques(at)hwg.org> |
| |
todo: View
Thread,
Original
|
|
hello,
ok. im getting somewhere now. but having some problems. the javascript
that ive managed to get together is...
<script>
<!--
function maxwordcount(cur){
var maxwords=100
if (document.images){
var temp=cur.words.value.split(" ")
if (temp.length>maxwords){
alert("Sorry, but you have exceeded the 100 word limit. Please reduce
the length of your company description. Thank you.")
return false
}
}
}
//-->
</script>
on the multiline box that its going to before ive got..
<textarea name="description" cols="20" rows="7" onblur="return
maxwordcount(this)"></textarea>
but, its comming up with an error - 'words.value' is not an object. this
script ive taken from a freebie place and has taken a while to find it.
it was a validation thing for when a form is submitted but i changed it
to onBlur so when the cursor leaves the box then it comes up with the
error if youve gone over your 100 words.
do i have to leave the script as an onsubmit validation? or am i doing
something wrong?
thankyou.
Rob.
HWG hwg-techniques mailing list archives,
maintained by Webmasters @ IWA
This page is part of a preserved archive of archives.hwg.org. The site is no longer active and its content is not maintained. For enquiries about this archive, write to archive(at)iwanet.org.