Hi all,
Have a site where a Javascript works on all other browsers except Safari.
Its a TD hover effect which first didnt work on ie, but when Javascript added, all works exept on Safari, and what it does is it uses the script function but changes the background color of the whole page. Could anyone please help? Personally have nihil knowledge of Javascript.
This is the code I found on the net:
var highlightbehavior=”TD”
var ns6=document.getElementById&&!document.all
var ie=document.all
function changeto(e,highlightcolor){
source=ie? event.srcElement : e.target
if (source.tagName==”TABLE”)
return
while(source.tagName!=highlightbehavior && 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==”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
}
And for each button (td) I have this:
<tr>
<td height=”20″ align=”left” valign=”middle” class=”style” onMouseover=”changeto(event, ‘#005191’)” onMouseout=”changeback(event, ‘#FFFFFF’)”><a href=”link.html”>Name</a></td>
</tr>
Please help.