欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

javascript使用onclick事件改變選中行的顏色

 更新時間:2013年12月30日 15:39:18   作者:  
javascript onclick事件改變選中行的顏色,方法簡單,大家參考使用吧

html頁面的table 中一行一行的顯示當然 div也行 可設(shè)置在鼠標放上去時改變其顏色 部分代碼如下

復(fù)制代碼 代碼如下:

<script type="text/javascript">
var currentActiveRow; //當前活動行

//改變選中行的顏色
function changeActiveRow(obj) {
    if (currentActiveRow) {
        currentActiveRow.style.backgroundColor = "";
    }
    currentActiveRow = obj;
    currentActiveRow.style.backgroundColor = "#F2F2F2";
}

</script>

然后在td上設(shè)置onmousehover或者onclick事件即可 onmouseover="changeActiveRow(this)"

相關(guān)文章

最新評論