I have this function that depending on the value passed will do what ever.

function menu(n){
    switch(n)
    {
      case 0:
        document.getElementById('sub2').style.display = 'none';
        document.getElementById('sub3').style.display = 'inline';
        menu1();
        break;
      case 1:
        document.getElementById('sub3').style.display = 'none';
        document.getElementById('sub2').style.display = 'inline';
        menu2();
        break;
    }      
  }

I also have an Image that when clicked will go to a different page. Is there an event that I can use to trigger this function after the page changes?

Thanks, Edouard.

Recommended Answers

All 2 Replies

Use the onload event somewhere in the NEW document, and put the script in it too.

I hope the script doesn't refer to the document you just left.

OK thanks I did that works great.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.