Changing Case

Click the button to change case of some text.


Code Example

  <script>
   var myText = "the DALLAS CowBoys";
   function printNames() {
	 alert("The text " + "'"+myText+"'" + " has been incorrectly entered, and JavaScript has been used to dislay the correctly formatted text to your browser.");
   }

   document.write(fixNames('the', 'DALLAS', 'CowBoys'))
	
	function fixNames() {
	  var s = ""
	  for (j=0; j<fixNames.arguments.length; ++j)
	    s += fixNames.arguments[j].charAt(0).toUpperCase() +
	    fixNames.arguments[j].substr(1).toLowerCase() + " "							
		return s.substr(0, s.length-1)
	}
  </script>