If i have a menu with submenus like this:

Code HTML4Strict:
<ul>
<li><a href="#">link</a>
  <ul>
     <a href="#anchor">anchorlink</a>
  </ul>
</li>
<li><a href="#">link</a>
  <ul>
     <a href="#anchor">anchorlink</a>
  </ul>
</li>
</ul>

As it looks now, the anchors only work if you are on the correct page, but if I want it to work from other pages I would have to do something like for example "index.php#anchor". My question is if it is possible to add the page-name (like "index.php") to an anchor if you click an anchor from another page.

like... if im on "about.php" and want to go to an anchor-link on "index.php".

If I were to add "index.php" etc to each link manually, wouldnt that mean the page have to be reloaded every time i click an anchor, even if on the correct page?