1·单元格背景变色
用css中class的方法实现,可以同时实现单元格的边框变化。关键:
value='button' onmouseover="this.className='button1'" onmouseout="this.className='button2'"2·单元格背景变色(另一种方法)*
这是两个不一样的写法,
知识点:
this.bgColor= 是标记内部名值对。
this.style.background= 则用到了CSS。
比如,你可以这样<td bgColor="#000">;不可以这样<td background="#000">
有如,你可以这样.css4td{background: #000;};不可以这样.css4td{bgColor: #000;}
3·单元格所在的列背景变色
4·鼠标经过单元格所在的行背景变色。
关键:
onmouseover="Cbg(this, '66ff99')" onmouseout="Cbg(this, 'ffffff')"5·鼠标经过单元格所在的行背景变色。(另一种方法)*
与单个单元格的区别是将
onmouseover="this.style.backgroundColor=''" onmouseout="this.style.backgroundColor=''"定义在“
TR”而不是“
TD”。
推荐使用加“*”的。还有其他可以实现的写法,都不一样。