The Javascript first...
(Purpose: When a user hovers over any link that is contained inside of a <li> tag, then change the background color of the <li>...)
1 - May have an issue with my elements, being that it is not possible to change the background on <li> elements...
2 - Possibly an issue of where I am using the "SomeElement".parentNode...
3 - Some other issue that I may be overlooking...
window.onload = initMenu();
function initMenu() {
for(i=0; i < document.links.length; i++) {
var thisLink = document.links[i];
if(thisLink.parentNode.tagName == "LI"){
setActivity(thisLink);
}
}
}
function setActivity(thisLink){
thisLink.onmouseover = mouseOver(thisLink);
thisLink.onmouseout = mouseOut(thisLink);
}
function mouseOver(thisLink) {
this.style.backgroundColor = '#D3FF06';
return this;
}
function mouseOut(thisLink) {
this.style.backgroundColor = '#171717';
return this;
}
That is the way the Javascript file reads for the site that I am building. Though, it is not functioning. If a Javascript connoisseur will be so kind to point out any syntactical/logical errors please do. I have been trying to make this work and haven't been able to for a few days now; while working on other projects...