-2
I need to make a comparison of the page I am loading with all elements of my tag a . so that finding the element he applies stylization. Someone can help me with this mistake?
window.onload =function(){
    
  var menu = document.getElementById('menu');
  var lista = document.getElementById('lista');
  var link = document.getElementsByTagName('a');
  var url_atual = window.location.href;
  
  for (i=0; i<link.length; i++ ){ //tira toda formatação da tag "a"
    link[i].style.backgroundColor = "";
    link[i].style.color = "";
  }
  menu.style.backgroundColor = "#ff0000"; // altera o fundo
  menu.style.color = "#ffffff"; // altera a cor
}<head>
</head>
<body id="menu">
  <ul id="lista">
     <li><a href="index.html">Home</a></li>
     <li><a href="#">Fotos</a></li>
     <li><a href="#" >Agenda</a></li>
     <li><a href="#" >Contato</a></li>
  </ul>
</body>
Can you add an executable example? I don’t quite understand what you want
– Douglas Teles
@Douglas Teles, from what I understand the goal is for the anchor element to appear in a different style if the address to which the anchor corresponds is the page address.
– MauroAlmeida
What comparison do you want to make? The question does not say.
– Sam