Created
April 5, 2016 19:22
-
-
Save anonymous/3ae6b93fd74dbaad47997e8aec2f48fe to your computer and use it in GitHub Desktop.
This file contains 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 addLinks () { | |
for (var i=0, link; i<5; i++) { | |
link = document.createElement("a"); | |
link.innerHTML = "Link " + i; | |
link.onclick = function () { | |
alert(i); | |
}; | |
document.body.appendChild(link); | |
} | |
} | |
// click vào 5 link đều ra số 5 | |
window.onload = addLinks; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment