javascript脚本
[code]function Menu_Init(obj){
var tds = obj.getElementsByTagName("td");
for (var i = 0; i < tds.length; i++)
{
if (tds[i].className == "MenuOptions")
{
tds[i].onmouseover = switch_bg;
tds[i].onmouseout = switch_bg;
}
}
}
function switch_bg(e){
if (this.className=="MenuOptions_click") return
this.className = (this.className == "MenuOptions") ? "MenuOptions_hilite" : "MenuOptions";
}[/code]
[b]Menu_Init(obj)[/b] 用于初始化 Table.
所需要的CSS
[code].MenuOptions{
padding:2px;
cursor:hand;
color:#000000;
}
.MenuOptions_hilite{
padding:1px;
border:outset 1px #669999;
cursor:hand;
color:#000000;
}[/code]
table示范
[code]<table id=MenuTools border="0" cellspacing="2" style="border:1px solid #000000;color:#000000;font-size:12px">
<tr>
<td class="MenuOptions" >大家好呀
<td class="MenuOptions" >很容易实现的效果
<td class="MenuOptions" >喜欢的就拿去用吧
<td >这个不允许加亮
</tr>
</table>[/code]
演示
[html]
<script>
function Menu_Init(obj){
var tds = obj.getElementsByTagName("td");
for (var i = 0; i < tds.length; i++)
{
if (tds[i].className == "MenuOptions")
{
tds[i].onmouseover = switch_bg;
tds[i].onmouseout = switch_bg;
}
}
}
function switch_bg(e){
if (this.className=="MenuOptions_click") return
this.className = (this.className == "MenuOptions") ? "MenuOptions_hilite" : "MenuOptions";
}
</script>
<style>
.MenuOptions{
padding:2px;
cursor:hand;
color:#000000;
}
.MenuOptions_hilite{
padding:1px;
border:outset 1px #669999;
cursor:hand;
color:#000000;
}
</style>
<table id=MenuTools border="0" cellspacing="2" style="border:1px solid #000000;color:#000000;font-size:12px">
<tr>
<td class="MenuOptions" >大家好呀
<td class="MenuOptions" >很容易实现的效果
<td class="MenuOptions" >喜欢的就拿去用吧
<td >这个不允许加亮
</tr>
</table>
<script>Menu_Init(MenuTools)</script>
[/html]
[code]function Menu_Init(obj){
var tds = obj.getElementsByTagName("td");
for (var i = 0; i < tds.length; i++)
{
if (tds[i].className == "MenuOptions")
{
tds[i].onmouseover = switch_bg;
tds[i].onmouseout = switch_bg;
}
}
}
function switch_bg(e){
if (this.className=="MenuOptions_click") return
this.className = (this.className == "MenuOptions") ? "MenuOptions_hilite" : "MenuOptions";
}[/code]
[b]Menu_Init(obj)[/b] 用于初始化 Table.
所需要的CSS
[code].MenuOptions{
padding:2px;
cursor:hand;
color:#000000;
}
.MenuOptions_hilite{
padding:1px;
border:outset 1px #669999;
cursor:hand;
color:#000000;
}[/code]
table示范
[code]<table id=MenuTools border="0" cellspacing="2" style="border:1px solid #000000;color:#000000;font-size:12px">
<tr>
<td class="MenuOptions" >大家好呀
<td class="MenuOptions" >很容易实现的效果
<td class="MenuOptions" >喜欢的就拿去用吧
<td >这个不允许加亮
</tr>
</table>[/code]
演示
[html]
<script>
function Menu_Init(obj){
var tds = obj.getElementsByTagName("td");
for (var i = 0; i < tds.length; i++)
{
if (tds[i].className == "MenuOptions")
{
tds[i].onmouseover = switch_bg;
tds[i].onmouseout = switch_bg;
}
}
}
function switch_bg(e){
if (this.className=="MenuOptions_click") return
this.className = (this.className == "MenuOptions") ? "MenuOptions_hilite" : "MenuOptions";
}
</script>
<style>
.MenuOptions{
padding:2px;
cursor:hand;
color:#000000;
}
.MenuOptions_hilite{
padding:1px;
border:outset 1px #669999;
cursor:hand;
color:#000000;
}
</style>
<table id=MenuTools border="0" cellspacing="2" style="border:1px solid #000000;color:#000000;font-size:12px">
<tr>
<td class="MenuOptions" >大家好呀
<td class="MenuOptions" >很容易实现的效果
<td class="MenuOptions" >喜欢的就拿去用吧
<td >这个不允许加亮
</tr>
</table>
<script>Menu_Init(MenuTools)</script>
[/html]