Page not reloading when click on Anchor tag

Hi All

I am using PHP server-side scripting to create a collapsable menu. The script works by dynamically drawing a table based on the variables fed to it from the anchor tag. This means that everytime a user clicks on a menu option the page must reload, in order to redraw the table.

Now to my problem. Every time the page reloads it jumps to the top of the page. This is particularly annoying if the section of the menu you are expanding is at the bottom of the page. The solution, add an anchor, so that when the page reloads it jumps back to the relevant menu section.

I tried this and it does work, but I have a major problem. Lets say I want to expand a part of the menu. I click on the link, the menu reloads (in expanded form) and jumps to the appropriate section. Now assume, that I straight away decide this is not the section I want and collapse that section of the menu. I reclick on that section of the menu, but nothing happens. The page simply wont reload. It seems that because the page is already at the right section it doesn’t want to reload.

I know I could write a script to force the page to reload, but I must pass a variable to the server in order to display the page properly.

Here is what the link looks like:


<td><a name="test"></a><img src="image1.png" alt="arrow">&nbsp;<a href="experience2.php?node=sub3_2#test" target="_self">Link</a></td>

I hope you can understand what I am talking about. I would much appreciate your thoughts on this.

Regards, Ben

This should force the browser to obey the link, regardless of the fact that it’s already at the anchor

<a href=“experience2.php?node=sub3_2#test” target=“_self” onClick=“return false;top.location.href=this.href;”>

People with javascript disabled will get the results you are getting now…Let me know…

Thanks for the reply.

I tried adding the JavaScript like you said, but it doesn’t work. When I click the link I get no kind of reaction at all. The link is now completely dead. seems to be a problem in the script, but I can’t figure out what. Any other suggestions?

Ben

Uh…maybe switch the commands around…

onClick=“top.location.href=this.href;return false;”

Sorry Beetle, I tried it but no joy. Could it have something to do with the use of “this”? Is it necessary to define an object before refering to it (assuming that “this” is a reference to an object)?

Ben

Hmmm, this may not work…just the same way the regular HREF doesn’t work…

no additional helpful thoughts at the moment…

sorry :frowning: