srcElement表格样式
发布时间:2016-12-30 来源:查字典编辑
摘要:functionchangeto(highlightcolor){source=event.srcElementif(source.tagN...
<scriptlanguage="JavaScript1.2">
functionchangeto(highlightcolor){
source=event.srcElement
if(source.tagName=="TR"||source.tagName=="TABLE")
return
while(source.tagName!="TD")
source=source.parentElement
if(source.style.backgroundColor!=highlightcolor&&source.id!="ignore")
source.style.backgroundColor=highlightcolor
}
functionchangeback(originalcolor){
if(event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore")
return
if(event.toElement!=source)
source.style.backgroundColor=originalcolor
}
</script>
<tableonMouseOver="changeto('white')"onMouseOut="changeback('#999999')">