Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Feedback on: irt.org FAQ Knowledge Base Q1047

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


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 21st December 2007. Maintained by: Martin Webb
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.