Copy Code code as follows:
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";
}
menu_init (obj) is used to initialize the Table.
The CSS you need
Copy Code code as follows:
. menuoptions{
padding:2px;
Cursor:hand;
Color: #000000;
}
. menuoptions_hilite{
padding:1px;
Border:outset 1px #669999;
Cursor:hand;
Color: #000000;
}
Table Demo
Copy Code code as follows:
<table id=menutools border= "0" cellspacing= "2" style= "border:1px solid #000000; color: #000000; font-size:12px" >
<tr>
<TD class= "Menuoptions" > Everyone.
<TD class= "Menuoptions" > The effect is easy to achieve
<TD class= "Menuoptions" > Please take it with you.
<TD > This does not allow highlighting
</tr>
</table>
Demonstrate
<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].on MouseOver = 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" > <tr> <td class= "menuoptions" > Hello, everyone. Ah <td class= "menuoptions" > very easy to achieve the effect of <TD class= "Menuoptions" > like to take to use it <TD > this does not allow highlighting </tr> < /table> <script>menu_init (menutools) </script>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]