首页 > 编程 > JavaScript > 正文

event.srcElement+表格应用

2019-11-21 02:32:31
字体:
来源:转载
供稿:网友
<script language="JavaScript1.2">
function changeto(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
}

function changeback(originalcolor){
if (event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore")
return
if (event.toElement!=source)
source.style.backgroundColor=originalcolor
}
</script>
<table onMouseOver="changeto('white')" onMouseOut="changeback('#999999')">
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表