Code:
//The constructor
function movieClass(moviePhoto, movieName, movieDirector, movieYear, movieGenre, movieCast, moviePlot, movieRank){
this.mPhoto = moviePhoto;
this.mName = movieName;
this.mDirector = movieDirector;
this.mYear = movieYear;
this.mGenre = movieGenre;
this.mCast = movieCast;
this.mPlot = moviePlot;
this.mRank = movieRank;
}
var arr = 0;
var movieArr = new Array();
movieArr[arr++] = new movieClass("img/therock.jpg", "The Rock", "Michael Bay", "1996", "Action", "Sean Connery, Nicolas Cage, Ed Harris", "A group of U.S. marines, under command of a renegade general, take over Alcatraz and threat San Francisco Bay with biological weapons. A chemical weapons specialist and the only man to have ever escaped from the Rock are the only ones who can prevent chaos.", "9");
movieArr[arr++] = new movieClass("img/independenceday.jpg", "Independence Day", "Roland Emmerich", "1996", "Action | Sci-Fi", "Will Smith, Bill Pullman, Jeff Goldblum", "The aliens are coming and their goal is to invade and destroy. Fighting superior technology, Man's best weapon is the will to survive.", "8");
movieArr[arr++] = new movieClass("img/thematrix.jpg", "The Matrix", "Andy & Larry Wachowski", "1999", "Action | Sci-Fi", "Keanu Reeves, Laurence Fishburne, Carrie-Anne Moss", "A computer hacker learns from mysterious rebels about the true nature of his reality and his role in the war against the controllers of it.", "9");
movieArr[arr++] = new movieClass("img/lordoftherings.jpg", "The Lord Of The Rings", "Peter Jackson", "2001", "Action | Fantasy", "Sean Astin, Sean Bean, Orlando Bloom", "In a small village in the Shire a young Hobbit named Frodo has been entrusted with an ancient Ring. Now he must embark on an Epic quest to the Cracks of Doom in order to destroy it.", "10");
movieArr[arr++] = new movieClass("img/austinpowers.jpg", "Austin Powers in Goldmember", "Jay Roach", "2002", "Comedy | Action", "Mike Myers, Beyoncé Knowles, Seth Green", "Upon learning that his father has been kidnapped, Austin Powers must travel to 1975 and defeat the aptly-named villain Goldmember - who is working with Dr. Evil.", "7");
//why this doesn't work???
function addMovie(){
var newMovName = document.getElementById("newMovieName").value; //simple text input
var arrend = movieArr.length;
movieArr[arrend] = new movieClass("blah source", newMovName, "blah blah");
printMovieList()
}
I know after refreshing the browser the new movie will be removed anyway, this is just for exercise purposes.
Bookmarks