Clicking Image Map Highlights Row

S

sling blade

Hello,

I have an image map of a subdivision and each section of land in the
subdivision has a lot number on it. Below the image map I have a table
with details about each lot (eg Lot Number, Lot Size, Lot Price
ect...)

I would really like a way so the user can click on the image map and
the corresponding row below the image will be highlighted.

The user clicks on a new row and the previous row goes back to its
original color and the new row is highlighted.

Is the possible? If it is and can someone please point me in the right
direction on how you would do this?
 
R

RobG

mscir wrote:
[...]
<map NAME="imagemap">
<area shape="rect" coords="20,25,84,113" onclick="change(1)" href ="#">

Using an empty anchor causes the page to scroll to the top when
the anchor is clicked. To stop this happening, have the onclick
return false:

<area ... onclick="change(1);return false;" href="#">
 
S

scottf35

One other thing, in the clearallrows function is there a way to have it
loop through each row dynamically rather than a fix number?
eg in VB
For Each Row in Table
change backcolor...
Next Row

The reason is that the table will lilely be generated from a database.
As the lots are sold then the information for that lot will not be
generated in the table any more.

So the total number of rows is likely to change over time.

Any ideas on this?
 
R

Randy Webb

One other thing, in the clearallrows function is there a way to have it
loop through each row dynamically rather than a fix number?
eg in VB
For Each Row in Table
change backcolor...
Next Row

The reason is that the table will lilely be generated from a database.
As the lots are sold then the information for that lot will not be
generated in the table any more.

So the total number of rows is likely to change over time.

Any ideas on this?

for (var i=0;i<tableLength;i++){
......
}

Where tableLength is a variable that is dynamically inserted by the same
language/script that dynamically generates the table.
 
S

scottf35

The language that will generate the table is asp.net.

The first idea I can think of to do this is to have a count function in
the SQL statement count the number of rows returned and then place this
amount in a session variable.

Do you know how you assign a javascript variable to a asp.net session
variable or any other dynamic variable?

Thanks for your help.
 
R

RobG

One other thing, in the clearallrows function is there a way to have it
loop through each row dynamically rather than a fix number?

Yes

If you give the table an id, the rows collection is returned
by:

var theRows = document.getElementById('tableID').rows;

To keep the users of older IE happy, do some feature testing and
add a document.all method (untested):

if (document.getElementById) {
var theRows = document.getElementById('tableID').rows;
} else if (document.all) {
var theRows = document.all('tableID').rows;
}

You can loop through the rows thusly:

for (var i=0; i<theRows.length; i++) {
theRows ....
}
 

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

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top