Created
March 3, 2012 16:41
-
-
Save skvggor/1966928 to your computer and use it in GitHub Desktop.
Array lesson for Davi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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