Mega Code Archive

 
Categories / JavaScript DHTML / Language Basics
 

Converting Strings to Upper Case

<HTML> <HEAD> <TITLE>Validate</TITLE> <SCRIPT>  function checkLawyer(str) {     if ((str.toUpperCase() == "JOE") || (str.toUpperCase() == "JOHN"))           alert ("JOHN and JOE are not allowed here...");     else        alert("Your application will be evaluated!");  }  </SCRIPT> </HEAD> <BODY> <FORM name="theForm"> <TABLE> <tr><td>Enter Your First Name (*): </td>     <td><INPUT type=text name="userFname"></td> </tr> <tr><td>Enter Your Profession (*): </td>     <td><INPUT type=text name="userProf"></td> </tr> <tr> <td colspan=2> <INPUT type=button name="theButton" value="SUBMIT QUERY" onClick="checkLawyer(window.document.theForm.userProf.value)";> </td> </tr> </TABLE> </FORM> </BODY> </HTML>