
Untitled
By: a guest on
May 15th, 2012 | syntax:
None | size: 1.18 KB | hits: 12 | expires: Never
var myPosts = function(){
var Posts = [];
return {
Count : function(){
return Posts.length;
},
Add : function(JSONData){
var jPosts = eval(JSONData);
for(a = 0; a<= jPosts.length - 1; a++)
{
var p = new Post(jPosts[a].ID, jPosts[a].Title, jPosts[a].imageURL, jPosts[a].thumbURL);
Posts.push(p);
}
},
ID : function(Index){
return Posts[Index].ID;
},
Title : function(Index){
return Posts[Index].Title;
},
imageURL : function(Index){
return Posts[Index].imageURL;
},
thumbURL : function(Index){
return Posts[Index].thumbURL;
}
}
}();
function Post(ID, Title, imageURL, thumbURL)
{
this.ID = ID;
this.Title = Title;
this.imageURL = imageURL;
this.thumbURL = imageURL;
}