Click to See Complete Forum and Search --> : Multiple Cell Highlites
Bongo
01-08-2003, 12:18 AM
Hi guys... situation is - upon mouse over any one cell, i wish to highlite that cell, plus some other cells in the table (depending on which cell mouse is currently over)
any pointers would be gladly accepted as i havent a clue what im doing:)
Nicodemas
01-08-2003, 01:01 AM
Hope this helps.
You must add onMouseover("changeto(event,'#color#')" onMouseout="changeback(event, '#color#')" to your TABLE tag.
<script language="javascript">
//################
var ns6=document.getElementById&&!document.all
var ie=document.all
function changeto(e,highlightcolor){
source=ie? event.srcElement : e.target
if (source.tagName=="TR"||source.tagName=="TABLE")
return
while(source.tagName!="TD"&&source.tagName!="HTML")
source=ns6? source.parentNode : source.parentElement
if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore")
source.style.backgroundColor=highlightcolor
}
function contains_ns6(master, slave) { //check if slave is contained by master
while (slave.parentNode)
if ((slave = slave.parentNode) == master)
return true;
return false;
}
function changeback(e,originalcolor){
if
(ie&&(event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore")||source.tagName=="TR"||source.tagName=="TABLE")
return
else if (ns6&&(contains_ns6(source, e.relatedTarget)||source.id=="ignore"))
return
if (ie&&event.toElement!=source||ns6&&e.relatedTarget!=source)
source.style.backgroundColor=originalcolor
}
</script>
Bongo
01-08-2003, 06:09 PM
mate that rocks... thanks heaps for that help:)
cheers man have a good one