Created
May 21, 2009 11:10
-
-
Save anonymous/115406 to your computer and use it in GitHub Desktop.
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 loadJSON() { | |
var headElt = document.getElementsByTagName('head')[0]; | |
var jsonScript = document.createElement('script'); | |
jsonScript.type = "text/javascript"; | |
jsonScript.src = "http://api.flickr.com/services/rest/?method=flickr.interestingness.getList&api_key=292580d2c6061fc5a49b852ee0ad977f&extras=original_format%2Clicense&per_page=100&page=1&format=json"; | |
headElt.appendChild(jsonScript); | |
} | |
function jsonFlickrApi(obj) { | |
var i = Math.floor(Math.random()*100); | |
var photo = obj.photos.photo[i]; | |
var url = "http://farm" + photo.farm + ".static.flickr.com/" + photo.server + "/"+ photo.id + "_" + photo.secret + ".jpg"; | |
var link = document.createElement('a'); | |
link.href = "http://www.flickr.com/photos/" + photo.owner + "/" + photo.id; | |
link.target = "_none"; | |
var image = document.createElement('img'); | |
image.setAttribute('src',url); | |
image.setAttribute('title',photo.title); | |
link.appendChild(image); | |
document.getElementById('flickphoto').removeChild(document.getElementById('rotator')); | |
document.getElementById('flickphoto').appendChild(link); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment