More of a javascript question

A

A Question

Hi I know its not really an asp.net question. But I need to select a number
of contiguous cells in a rendered table.

So, I need to determine how to manage the following operation.

I click in cell#1 and as I drag my mouse over the nearby cells to the right
or the left those cells I set the background color of them, or set an
attribute.

Im not quite sure of the best way to do this, so any pointers would be of
help.

Cheers
 
C

cfps.Christian

This can be rather complex but I'll try to sum it up as best as I can
and as I'm understanding.

It sounds like you want to "highlight" cells as you hold the mouse
down and go over. If so I would have a mousedownevent in the cell(s)
you wish to start at that sets a boolean to true that says something
like: bHighlighting = true;

Then in the mouseover event of the cell(s) I would have:
<td onmouseover="CellMouseOver(this);"></td>
function CellMouseOver(o)
{
if (bHighlighting)
{
ChangeBackgroundorAttribute(o);
}
}

Now if you need to do it via column/rows, in the past I have used the
value of the cell to have a column or row in there so that I could
determine which row I was working with. You could use some kind of
naming convention or there might be a way to go up in the row object
to find out what the column/row is.
 
A

A Question

Hi,

yeah, well this does work, except that it still allows the document to
select the document itself. For example, you can click and select a cell
range in a html table, and I want to prevent this when I am selecting the
cells in my table.

Really, I need to know how to cancel the mouse down even from bubbling back
up and allowing this behaviour.
 

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
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top