<HTML> <HEAD> <SCRIPT LANGUAGE="JavaScript"> function testLetter(form){ inpVal = form.entry.value; if (inpVal != "") { if (inpVal == "A") { alert("Thanks for the A."); } else if (inpVal == "B") { alert("Thanks for the B."); } else if (inpVal == "C") { alert("Thanks for the C."); } else { alert("Sorry, wrong letter or case.") } } else { alert("You did not enter anything.") } } </SCRIPT> </HEAD> <BODY> <FORM> Please enter A, B, or C and press Enter key: <INPUT TYPE="text" NAME="entry" onChange="testLetter(this.form)"> </FORM> </BODY> </HTML>
Related Scripts with Example Source Code in same category :