Hello,
I’m trying to learn JavaScript on my own and am using a Dashcode example (if anybody uses Dashcode, the example is the “Browser” web application template that is shown when Dashcode opens).
Briefly, the JavaScript generates a list of “Locations” in the USA:
// Sample data. Some applications may have static data like this, but most will want to use information fetched remotely via XMLHttpRequest.
var parks = [
{ name: "Acadia", location: "Maine, USA" },
{ name: "Bryce Canyon", location: "Utah, USA" },
{ name: "Carlsbad Caverns ", location: "New Mexico, USA" },
etc
Clicking on any of these locations takes you to a separate page that states the same text for each location (last line of code below):
"The scenery in “Location” is amazing this time of the year.
// When the park is set, this controller also updates the DOM for the detail page appropriately. As you customize the design for the detail page, you will want to extend this code to make sure that the correct information is populated into the detail UI.
var detailTitle = document.getElementById('detailTitle');
detailTitle.innerHTML = this._park.name;
var detailLocation = document.getElementById('detailLocation');
detailLocation.innerHTML = this._park.location;
var detailDescription = document.getElementById('detailDescription');
detailDescription.innerHTML = "The scenery in " + this._park.name + " is amazing this time of year!";
}
};
I want to retain the layout and structure but, depending on the “Location” have different text for each of the new pages (not "the scenery is amazing etc).
Would someone please get me going on how to achieve this, please? I do not know where to start. If someone could supply me with the code that would work, I would be very grateful.
Many thanks.