Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org

Feedback on: irt.org FAQ Knowledge Base Q1047, on October 01, 2002 at 18:43:29:

You are here: irt.org | About | Feedback | 4183 [ previous next ]

Feedback on:
irt.org FAQ Knowledge Base Q1047

Sent by
Bill Wilkinson on October 01, 2002 at 18:43:29:

Worth:
Worth reading

Length:
Too short

Technical:
Not technical enough

Comments:
The answer using onKeyUp is *BOGUS*! What happens if the user copy/pastes the text in using a mouse? Where does any onKeyUp even happen in that case?

This question misses the easiest answer of all that works on *ALL* browsers of which I am aware.

Just use a setTimeout to check the length of the text in the textarea every quarter second or so. Designer's choice as to whether it just chops the text to max size or pops up an alert.

Start the process at page load time and it works every time.

function checkTASize( )
{
var ta = document.FormName.TextAreaName;
if ( ta.value.length > 300 )
{
alert("Sorry...300 character limit");
ta.value = ta.value.substring(0,300);
}
setTimeout( "checkTASize()", 250 );
}
checkTASize( );





Other feedback on 'irt.org FAQ Knowledge Base Q1047' - show all

©2018 Martin Webb