/    Sign up×
Community /Pin to ProfileBookmark

Accessibilty and links

Hi,

Just a quickie hopefully.

I have developed an online shop which the client required to be accessible. So the site is fully developed in xhtml 1.1 and functions well.

I want to add the niceities that JS / AJAX can bring to tthe users experience but need a little help.

Since the target attribute is supported in the standards I have links that open in the current window if JS is off but if it is on JS can open a new window for a link. like so….

<a href=”http://www.artscouncil.org.uk/” title=”Arts Council – England” onclick=”window.open(this.href); return false;” onkeypress=”window.open(this.href); return false;”><span>Arts Council – England</span></a>

NOW

I want to use the same functionality with my shopping cart. So what I envisgaed was a link to add an item to the cart like so

<a href=”/online_shop/index.php?section=3&amp;cat=1&amp;id=2&amp;action=additem&goto=cart2″ title=”Add Item” onclick=”changeCart(this.href); return false;” onkeypress=”changeCart(this.href); return false;”><span>Add Item</span></a>

the intention being that I split the url up in JS to take the appropriate action, update the cart using ajax and redraw the content of the cart div WITHOUT going to a new page.

However, after a bit of testing and tinkering the onclick=”changeCart(this.href); return false;” doesn’t stop the request to go to a new page.

Can anyone please give me some pointers – for which I will be very greatful.

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@ToonMarinerauthorNov 22.2006 — #BUMP#

Is this possible? can I have a link with a url to another page that when clicked DOESN't Load that page (ie doesn't send the headers to the server0 but DOES call a js function specified?
×

Success!

Help @ToonMariner spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...