Mega Code Archive

 
Categories / JavaScript Tutorial / Form
 

Compare the value in TextField

< HTML> <HEAD>    <TITLE>Validate</TITLE> <SCRIPT> function checkLawyer(str) {      if ((str.toUpperCase() == "LAWYER") || (str.toUpperCase() == "ATTORNEY"))       alert ("Lawyers are not wanted here...");    else       alert("Your application will be evaluated!"); } </SCRIPT> </HEAD> <BODY> <FORM name="theForm"> Enter Your Profession: <INPUT type=text name="userProf"> <INPUT type=button         name="theButton"         value="SUBMIT QUERY"         onClick="checkLawyer(window.document.theForm.userProf.value)";> </FORM>   </BODY> </HTML>