There is a code by which I select active links:
onload = function () { for (var lnk = document.links, j = 0; j < lnk.length; j++) if (lnk [j].href == document.URL) lnk [j] .style.cssText = 'background-color: #418CD0;'; } But it does not work as I would like. The fact is that I bring the news to the main page (In this case, the link to the Main page is highlighted in navigation), but when I switch to another page URL/?page=n or when I go to the news news/?id=n , then the Highlight the page disappears, but I would like it to be highlighted, as the news and navigation through the pages are on the Main page.
Please help. Thank you so much in advance!
document.URLtry usingdocument.URL.split(/[\?#]/)[0]. - Vismanvar lnk = document.getElementsByTagName('a')instead ofdocument.links- Jean-Claude