Created
September 22, 2012 00:13
-
-
Save TravisL12/3764627 to your computer and use it in GitHub Desktop.
An attempt at JS
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
var blogs = [ | |
{"Title" : "Rebuilding shit", | |
"Post" : "I think progress has been made\. I think progress has been made\. I think progress has been made\. I think progress has been made\. I think progress has been made\. I think progress has been made\. I think progress has been made\. I think progress has been made\. ", | |
"Footer" : "September 3rd 2012" | |
}, | |
{"Title" : "Second post containting stuff", | |
"Post" : "Practice makes perfect\. Practice makes perfect\. Practice makes perfect\. Practice makes perfect\. Practice makes perfect\. Practice makes perfect\. " , | |
"Footer" : "October 2nd 2012" | |
}, | |
{"Title" : "The third thing I've typed out", | |
"Post" : "At this point I am trying to determine how a \'for\' loop effects what is drawn on a page\." , | |
"Footer" : "December 4th 2012" | |
} | |
]; | |
window.addEventListener("DOMContentLoaded", function() { | |
target = document.getElementById("post-index"); | |
for(var i=0; i<blogs.length; i++) { | |
var element = document.createElement('li'); | |
element.addEventListener('click', function(event) { alert(event.target +'was clicked'); }); | |
element.appendChild(document.createTextNode(blogs[i]['Title'])); | |
target.appendChild(element); | |
} | |
}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment