UTILIZING: MICROSOFT WEBMATRIX 3
UTILIZING EXTERNAL CSS AND JAVASCRIPT FILES
Need help with a Horizontal Navigation Bar – that has a ACTIVE/CURRENT NAVIGATION LINK I am unable to get this to work. I have the navigation bar that works just fine, I am unable to get the ACTIVE/CURRENT LINK to work. So basically, when a user is on a certain page, the tab corresponding to that page, highlights in a color, so that the user knows what page they are on. This is the code I have: ((Please reply and let me know if you need anymore information!!)) Thanks so much in advance.
[B]CSS Code:
ul#menu {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
}
ul#menu li {
float: left;
}
ul#menu li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li#menu a:hover:not(.active) {
background-color: #111;
}
#menu .active {
background-color: #4caf50;
}
[B]JavaScript Code:
document.getElementById(“nav01”).innerHTML =
“<ul id=’menu’>”
“<li><a class=’.active’ href=’index.html’>Home</a></li>”
“<li><a href=’contact.html’>Contact</a></li>”
“<li><a href=’about.html’>About</a></li>”
“<li><a href=’services.html’>Services</a></li>”
“</ul>”;