/    Sign up×
Community /Pin to ProfileBookmark

JS Slideshow Help!

Does anyone know how I can get links in a slide show that use the same image map co-ordinates to submit different values to a shopping cart!

For example, I have three images in my slide show, each with three products on them and each with three ‘Add to cart’ links created using an image map. I want each link to submit unique values to the shopping basket but can so far only get it to work for the first image. I dont know how to set it up so that when the second image in the slideshow is loaded, the image maps will submit different values to the basket.

Here is some of my code:

Image Map

<map name = “prodmap”>
<area href = “JavaScript:additem(‘Fatherxmas’, 1.95,1);” shape = “rect”
coords = “39,217,110,250”/>
<area href = “JavaScript:additem(‘Bears’, 2.99,1);” shape = “rect”
coords = “180,217,250,250”/>
<area href = “JavaScript:additem(‘Dinosaurs’, 1.65,1);” shape = “rect”
coords = “325,217,398,250”/>
</map>

AddItem function:

function additem(desc, price,quantity) {
items[++numitems] = new Item(desc,price,quantity);
displaycart();
}

Hopefully someone will understand this problem an be able to offer some help!

Thanks!

to post a comment
JavaScript

1 Comments(s)

×

Success!

Help @MosDef 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.3,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...