Complex sticky rollovers on map.

L

Luke

Hi there.

Tricky one this. I am thinking of creating a map of our county
(Northamptonshire, UK) but I want users to be able to select 2 or more
areas by clicking on them once.

When they have picked say 3 areas, if they then click a next/submit
button the codes for the selected areas are passed to the next page.

I envision a different colour rollover and a third colour for the
selected state.

Would it then be possible to deselect an area by clicking it again????

This is bassically for a vacancies website.

Not sure how easy this would be, I am a designer rather than
programmer so you'll have to spell it out.

In fact thinking this through it might all be easier in Flash??? I
shall ponder on that.


TIA
Luke
 
L

Larry Bud

Hi there.

Tricky one this. I am thinking of creating a map of our county
(Northamptonshire, UK) but I want users to be able to select 2 or more
areas by clicking on them once.

When they have picked say 3 areas, if they then click a next/submit
button the codes for the selected areas are passed to the next page.

I envision a different colour rollover and a third colour for the
selected state.

Would it then be possible to deselect an area by clicking it again????

This is all possible. You'd have to keep the selected items in some
sort of array, then roll out the first selected as a new one comes in
(FIFO-first in, first out).
 
T

Thomas 'PointedEars' Lahn

Larry said:
(e-mail address removed) (Luke) wrote in message news:<[email protected]>...

Please do not write attribution novels.
[...] I am thinking of creating a map of our county
(Northamptonshire, UK) but I want users to be able
to select 2 or more areas by clicking on them once.

When they have picked say 3 areas, if they then click a next/submit
button the codes for the selected areas are passed to the next page.
[...]
Would it then be possible to deselect an area by clicking it again????

Your Question Mark key is borken. [psf 2.3]
This is all possible. You'd have to keep the selected items in some
sort of array, then roll out the first selected as a new one comes in
(FIFO-first in, first out).

It seems to me that you have misunderstood the request. A FIFO (queue)
would not be an appropriate data structure, AIUI he does not want the
area to be deselected automatically if a certain number has been
selected. An associative array would be. There is no such data
structure in ECMAScript and its implementations, but an object can
provide the functionality of it:

var areas = {
items: {},
toggle: function(a) {
if (typeof this.items[a] != "undefined")
{
delete this.items[a];
// deselect the area
}
else
{
this.items[a] = 1;
// (re-)select the area
}
}
};

<map ...>
<area ... onclick="areas.toggle('area51'); return false">
...
</map>


F'up2 comp.lang.javascript (please do not crosspost over hierarchies)

PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top