贼聂中文网 - 传承弘扬,中华优秀传统文化!

l the a elements within li elements in the header menu var aElements = document.querySelectorAll('.allMenu.Left li a'); // Loop through each a element and check if its id matches navclassid for (var i = 0; i < aElements.length; i++) { var aElement = aElements[i]; if (aElement.id == navclassid) { aElement.classList.add('on'); break; // Exit the loop once a match is found } }