Skip to content

Instantly share code, notes, and snippets.

@skvggor
Created March 3, 2012 16:41
Show Gist options
  • Save skvggor/1966928 to your computer and use it in GitHub Desktop.
Save skvggor/1966928 to your computer and use it in GitHub Desktop.
Array lesson for Davi
function criar_menu() {
var div, arr_nomes, i, li;
arr_nomes = ['Marcos', 'Anderson', 'Lucas', 'Meire', 'Gustavo', 'Juliana'].sort();
li = [];
div = document.getElementById('menu');
for (i = 0; i < arr_nomes.length; i += 1) {
li[i] = document.createElement('li');
li[i].innerHTML = '<a href="' + arr_nomes[i].toLowerCase() + '.html">' + arr_nomes[i] + '</a>';
div.appendChild(li[i]);
}
}
window.onload = criar_menu;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment