Created
June 14, 2016 18:06
-
-
Save timothy/4cd7ba87a833140a06b608dcb059c681 to your computer and use it in GitHub Desktop.
DOM Manipulation
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>DOM Manipulation</title> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
/** | |
* Add new DOM elements | |
*/ | |
function adDnD(numOfDomElmnts) { | |
for (var i = 0; i < numOfDomElmnts; i++) { | |
document.getElementById('numbers').innerHTML += '<div id="item1' + i + '">' + i + '</div>'; | |
document.getElementById('box').innerHTML += '<div id="item2' + i + '">boxes' + i + '</div>'; | |
} | |
} | |
window.onload = function () { | |
adDnD(15); | |
} | |
</script> | |
<div id="box"></div> | |
<div id="numbers"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment