Difference between revisions of "JSON"
Jump to navigation
Jump to search
(Created page with "==JSON Navigation== ''' JSON File ''' <pre> var mainNav = [{ item: "Home", url: "../index.html" }, { item: "Product V...") |
|||
| Line 1: | Line 1: | ||
==[[ JSON Navigation]]== | ==[[ JSON Navigation]]== | ||
''' JSON File ''' | |||
<pre> | <pre> | ||
var mainNav = [{ | var mainNav = [{ | ||
Revision as of 21:29, 30 November 2016
JSON File
var mainNav = [{
item: "Home",
url: "../index.html"
},
{
item: "Product Videos",
url: "../videos/index.php"
},
{
item: "Photo Gallery",
url: "../photogallery.html"
},
{
item: "Installation Instructions",
url: "../installation/index.html"
},
{
item: "Catalog Download",
url: "../catalog/index.html"
},
{
item: "Tradeshows",
url: "../tradeshow.html"
}
];
Function That Creates the Navigation and Calls it
function showMainNav(arr) {
var output = "<ul>";
var i;
for (i = 0; i < arr.length; i++) {
output += '<a href="' + arr[i].url + '">' + '<li>' + arr[i].item + '</li></a>';
}
if (elements.mainNavigation !== null) {
elements.mainNavigation.innerHTML = output + '</ul>';
} // end if
} // end showMainNav
showMainNav(mainNav);