enter image description here

It is necessary to replace the link "sates0.html" with "index.html" but first you need to find it through id and tag (a).

How to do it?

    2 answers 2

    document.getElementById("foto").querySelector("a").setAttribute("href", "something2.html"); 
     <div id="foto"> <a href="something.html">Link</a> </div> 

      What is your first answer did not fit? Here is a slightly shorter option and with the links that you have.

       document.querySelector('#foto a').href = 'index.html' 
       <div id="foto"> <a href="sates0.html">Link</a> </div> 

      • everything works the best you))) - Sasha Mironov