javascript onclick事件改变选中行的颜色,方法简单,大家参考使用吧
html页面的table 中一行一行的显示当然 div也行 可设置在鼠标放上去时改变其颜色 部分代码如下
复制代码 代码如下: <script type="text/javascript"> var currentActiveRow; //当前活动行
//改变选中行的颜色 function changeActiveRow(obj) { if (currentActiveRow) { currentActiveRow.style.backgroundColor = ""; } currentActiveRow = obj; currentActiveRow.style.backgroundColor = "#F2F2F2"; }
</script>
然后在td上设置onmousehover或者onclick事件即可 onmouseover="changeActiveRow(this)" |