一个很简单的办法实现TD的加亮效果.
2018-09-24 21:44
<script>
functionMenu_Init(obj){
vartds=obj.getElementsByTagName(td);
for(vari=0;i<tds.length;i++)
{
if(tds[i].className==MenuOptions)
{
tds[i].onmouseover=switch_bg;
tds[i].onmouseout=switch_bg;
}
}
}
functionswitch_bg(e){
if(this.className==MenuOptions_click)return
this.className=(this.className==MenuOptions)?MenuOptions_hilite:MenuOptions;
}
</script>
<style>
padding:2px;
cursor:hand;
color:#000000;
}
.MenuOptions_hilite{
padding:1px;
border:outset1px#669999;
cursor:hand;
color:#000000;
}
</style>
<tableid=MenuToolsborder=0cellspacing=2style=border:1pxsolid#000000;color:#000000;font-size:12px>
<tr>
<tdclass=MenuOptions>大家好呀
<tdclass=MenuOptions>很容易实现的效果
<tdclass=MenuOptions>喜欢的就拿去用吧
<td>这个不允许加亮
</tr>
</table>
<script>Menu_Init(MenuTools)</script>
下一篇:Go语言结构体定义和使用方法