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

Q777 How can I constantly check to see if and when the user has entered a specific word in a text box?

irt.org | Knowledge Base | JavaScript | Form 6 | Q777 [ previous next ]

Q777 How can I constantly check to see if and when the user has entered a specific word in a text box?

You need a polling JavaScript function that doesn't tie up the browser, but returns control back to the browser for a while they checks again:

<FORM NAME="myForm">
<INPUT TYPE="TEXT" NAME="myText">
</FORM>

<SCRIPT LANGUAGE="JavaScript"><!--
function monitorText() {
    if (document.myForm.myText.value.indexOf('skip') > -1)
         alert('detected skip');
    else
        setTimer('monitorText()',1000); // checks field every 1000 milliseconds
}

monitorText();
//--></SCRIPT>

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.