event.srcElement+表格應(yīng)用
更新時(shí)間:2006年08月29日 00:00:00 作者:
<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')">
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')">
相關(guān)文章
Javascript中關(guān)于Array.filter()的妙用詳解
大家應(yīng)該都知道filter是Javascript中Array常用的操作,它用于把Array的某些元素過濾掉,然后返回剩下的元素。下面這篇文章就給大家介紹了關(guān)于Javascript中Array.filter()的妙用,有需要的朋友們可以參考借鑒,下面來一起看看吧。2016-12-12
利用JavaScript實(shí)現(xiàn)繪制2023新年煙花的示例代碼
大家過年好!新春佳節(jié),在這個(gè)充滿喜悅的日子里,愿新年的鐘聲帶給你一份希望和期待。在這喜慶的日子里,小編和大家分享一個(gè)煙花代碼,希望大家能夠喜歡2023-01-01
iframe實(shí)現(xiàn)與父頁面跨域隔離的JavaScript?代碼沙箱
這篇文章主要介紹了使用iframe實(shí)現(xiàn)與父頁面跨域隔離的JavaScript代碼沙箱,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-05-05
JS 輸入字?jǐn)?shù)判斷實(shí)現(xiàn)代碼
判斷輸入的字?jǐn)?shù)2009-08-08
微信小程序中的數(shù)據(jù)存儲(chǔ)實(shí)現(xiàn)方式
這篇文章主要介紹了微信小程序中的數(shù)據(jù)存儲(chǔ)實(shí)現(xiàn)方式,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2021-08-08
鼠標(biāo)劃過實(shí)現(xiàn)延遲加載并隱藏層的js代碼
鼠標(biāo)劃過延遲加載隱藏層的效果,想必大家都有見到過吧,在本文將為大家詳細(xì)介紹下使用js是如何實(shí)現(xiàn)的,感興趣的朋友可以參考下2013-10-10

