Skip to content

Instantly share code, notes, and snippets.

@adampolselli
Created April 1, 2009 01:24
Show Gist options
  • Save adampolselli/88491 to your computer and use it in GitHub Desktop.
Save adampolselli/88491 to your computer and use it in GitHub Desktop.
function parseResponse(data) {
var bookshelf = document.getElementById("bookshelf");
for (var i=0; i<6; i++) {
var cover = data.reader_books[i].book_edition.covers.cover_medium;
var title = data.reader_books[i].book_edition.title;
var permalink = data.reader_books[i].permalink;
var link = document.createElement("a");
link.setAttribute("href",permalink);
var img = document.createElement("img");
img.setAttribute("src",cover);
img.setAttribute("alt",title);
if (i % 2 == 0) {
img.setAttribute("class","odd");
}
link.appendChild(img);
bookshelf.appendChild(link);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment