Jump to content

Adding nice bits to a site


ToonMariner

Recommended Posts

Hi there, posted something similar on webdeveloper.com but to no avail....

What I want to do is add javascript to enhance the users experience.  I have a site that is created in xhtml 1.1 and the whole thing works very well at the moment without any client side scripting so in terms of accessibility on that front I am happy.

Now the target attribute for an achor tag is not valid markup (even though browsers still seem to support it) so I had a few associate links that with JS off open in the current window but open in a new window if it its on using:

<a href="http://www.nr-foundation.org.uk/" title="Northern Rock Foundation" onclick="window.open(this.href); return false;" onkeypress="window.open(this.href); return false;"><span>Northern Rock Foundation</span></a>

now this works beatutifully.  What I would like to achieve is somethig similar for the shopping cart I have built but calling a JS function instead off window.open.  Something like this:

<a href="/index.php?action=additem&amp;id=34&amp;num=3" title="Add Item" onclick="cartAdd(this.href); return false;" onkeypress="cartAdd(this.href); return false;"><span>Add Item</span></a>

My intention was to use JS to split the url so I could grab the action, id and num and use those parameters in an ajax request to update the shopping cart without having to 're-fresh' the whole page.
Link to comment
https://forums.phpfreaks.com/topic/28076-adding-nice-bits-to-a-site/
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.