[thelist] javascript multiple events

Stephen Rider evolt_org at striderweb.com
Tue Jul 10 10:15:45 CDT 2007


Not a JS guru myself, but here's my take:

Set the current (rolled over) table cell to a variable.  Use the  
previousSibling and nextSibling properties of that cell to identify  
the left and right cells.  Set those to variables.  Then you  
javascript can do whatever you want to those cells.

something like...

<td onmouseover="doStuff(this);"></td>


function doStuff($middleCell) {
	$leftCell = $middleCell.previousSibling;
	$rightCell - $middleCell.nextSibling;
//do stuff to the cells
}


See...
<http://www.w3schools.com/dom/prop_element_nextsibling.asp>

-- 
Stephen Rider
<http://striderweb.com/>



On Jul 10, 2007, at 9:59 AM, Bruce Gilbert wrote:

> I am still trying to figure out the best way to code an effect I am  
> trying
> to achieve with JavaScript. I will have a table with three table  
> cells. The
> middle cell will have a menu with rollover effects. This part, I am  
> familiar
> with, but I also want synchronous events in the left and right  
> cells. In the
> left cell, I want a picture that changes when you rollover a  
> related menu
> item in the center cell, and in the right cell, some associative  
> text will
> display.
>
> Can anyone point me in the right direction for this? I did some  
> googling,
> but didn't find exactly what I needed. I am by no means an expert  
> in JS, so
> might need some assistance as to the basics as to how this can be
> accomplished. I assume it would involve giving each td an id, and  
> then a
> getElementbyID call or something...
>



More information about the thelist mailing list