Jump to content


Problems with anchor.....

  • Please log in to reply
1 reply to this topic

#1 ToonMariner

  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 27 October 2006 - 09:02 AM

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.....

<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>
	<a href="?section=3&amp;cat=1&amp;id=5&amp;action=additem#cart5" title="Add Item">+</a>
	<td class="cost">£&nbsp;899.99</td>

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!)
follow me on twitter @PHPsycho

#2 fenway

  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 28 October 2006 - 04:16 PM

I'm not sure I understand how this is being performed.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users