spewn
Programmer
- May 7, 2001
- 1,034
here's my script:
this works fine in ie. counts as the person types, if char count goes over 100 then it erases the last char, etc.
however, in firefox, it won't remove last char. everything else works tho. there is no javascript error, either.
no idea. i know that the DOM varies slightly, but don't know if that's the issue.
any ideas?
- g
Code:
<script>
function showcharactercount() {
mbody=document.getElementById('body1').value;
mbcount=mbody.length;
document.getElementById('charactercount').innerHTML=mbcount;
if (mbcount>135) {
newstr = mbody.slice(0,mbcount-1);
document.getElementById('body1').innerHTML=newstr;
showcharactercount();
}
}
</script>
<textarea class=srch style='width:281;height:52;' id=body1 name=body1 onkeyup=showcharactercount()></textarea><br><br>
<span id=charactercount name=charactercount></span> characters / 100 maximum
this works fine in ie. counts as the person types, if char count goes over 100 then it erases the last char, etc.
however, in firefox, it won't remove last char. everything else works tho. there is no javascript error, either.
no idea. i know that the DOM varies slightly, but don't know if that's the issue.
any ideas?
- g