Jump to content

Problems with anchor.....


ToonMariner

Recommended Posts

Hi everyone.

OK valid xhtml1.1 page, I have a shopping cart that is placed inside a fixed height div (so it scrolls rather than fills the page up).  Each item in the shopping cart is displayed like so.....

[code]
<tr class="odd">
<td class="name"><a id="cart5"></a><a href="?section=3&amp;cat=1&amp;id=5" title="Dead Glass">Dead Glass</a></td>
<td class="number">
<a href="?section=3&amp;cat=1&amp;id=5&amp;action=removeitem#cart5" title="Remove Item">-</a>
1
<a href="?section=3&amp;cat=1&amp;id=5&amp;action=additem#cart5" title="Add Item">+</a>
</td>
<td class="cost">£&nbsp;899.99</td>
</tr>
[/code]

Now the idea here is that either side of the quantity is a link to add/remove, and when the user clicks one the #cart5 part of teh url will mean that on the resulting page this record will be pushed up to the top of the container, using the (<a id="cart5"> anchor) of the shopping cart (so the user can see it once more.)

This works once only. When the next page is finished processing the link does NOT work again (the url is correct - I have checked) but clicking that url simply does not perform anything.  If I remove the #cartX you can sucessfully add/remove items many times using those links...

Can anyone suggest why this is happening?

Any help would be very much appreciated...

PS: this aspect is imply to make the cart work without js (but I have not put the js in yet!)
Link to comment
https://forums.phpfreaks.com/topic/25284-problems-with-anchor/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.