-2

Probably I still don't understand the main concept. Could you please kinly let me know what do I need to change to get it started working? The code is:

<script>

var p = document.getElementById('logotop');
if (p.className == "logolink")
  {
  if (p.complete)
    {
    p.className = "logolink2";
    }
  }

</script>

It has to change the class of the 'logotop' object right after it gets loaded. I need to have it working right after I visit my page. I put it into

<head>
</head>

Thank you in advance.

  • You're running it too early. It's executing before the elements you need have been rendered to the page. Move it to right before the closing body tag – j08691 May 22 '21 at 19:11

0 Answers0