M
michael
Below is a simplified version of table cell mouseover script, running
separate from the HTML code, that was posted on this group yesterday:
var d=document, td;
function mover(){
this.style.background="red";
td[0].style.background="lime"; // TEST: change 1st cell via any td mouseover
alert(this.td.style.index.value) // HOW TO RETURN THIS TD INDEX VALUE?
}
function mout(){
this.style.background="";
}
td=d.getElementById("myTable").getElementsByTagName("td");
for(var ii=0;ii<td.length; ii++){
td[ii].onmouseover=mover;
td[ii].onmouseout=mout;
}
-----------------------
I found I can easily affect any other separate td by simply:
td[0].style.background="lime";
However, I need to figure which cell the mouse is over in order to make
above "td[depend on this value]" and do a couple of if conditions to
produce slightly different result based on the offset of that value.
How could I retrieve the current index value? Along the lines of this
non-working syntax:
alert(this.td.style.index.value)
What would a correct method/syntax be? Is it the HTMLTableCellElement index
value and if so how can I return that value in the mover function?
Thanks,
michael
separate from the HTML code, that was posted on this group yesterday:
var d=document, td;
function mover(){
this.style.background="red";
td[0].style.background="lime"; // TEST: change 1st cell via any td mouseover
alert(this.td.style.index.value) // HOW TO RETURN THIS TD INDEX VALUE?
}
function mout(){
this.style.background="";
}
td=d.getElementById("myTable").getElementsByTagName("td");
for(var ii=0;ii<td.length; ii++){
td[ii].onmouseover=mover;
td[ii].onmouseout=mout;
}
-----------------------
I found I can easily affect any other separate td by simply:
td[0].style.background="lime";
However, I need to figure which cell the mouse is over in order to make
above "td[depend on this value]" and do a couple of if conditions to
produce slightly different result based on the offset of that value.
How could I retrieve the current index value? Along the lines of this
non-working syntax:
alert(this.td.style.index.value)
What would a correct method/syntax be? Is it the HTMLTableCellElement index
value and if so how can I return that value in the mover function?
Thanks,
michael