Skip to content

Instantly share code, notes, and snippets.

@hughfdjackson
Forked from anonymous/gist:1680643
Created January 26, 2012 02:47
Show Gist options
  • Select an option

  • Save hughfdjackson/1680645 to your computer and use it in GitHub Desktop.

Select an option

Save hughfdjackson/1680645 to your computer and use it in GitHub Desktop.
Lordveda - pastebin.com/UDjr6Cxd
// initialize the counter and the array
var numnames = 0;
var names = new Array();
function SortNames(){
// Get the name from the text field and convert it to Upper Case
var thename = document.theform.newname.value;
thename=thename.toUpperCase();
// Add the name to the array
names[numnames] = thename;
// Increment the counter
numnames++;
// Sort the array
names.sort();
document.theform.sorted.value=names.join("\n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment