Each time a switch is displayed, in fact, only in the last show and this time to show the two switch between, but the above are widely used in the code, is logically equivalent to the brain residue, are all associated with the display area of the unified hide and then show this to show. For each statement of the implementation of the mechanism of people who know very clearly that this kind of garbage code to the hardware and the waste of execution efficiency, especially to switch the number of display areas, destruction and waste more serious.
HTML code
<span onmousemove= "Web effects: ShowTab (' tab ', 3,1)" Id=tab1 class=tab_btn_show> content </span>
<span onmousemove= "javascript:showtab (' tab ', 3,2)" id=tab2 class=tab_btn_normal> content two </span>
<span onmousemove= "javascript:showtab (' tab ', 3,3)" Id=tab3 class=tab_btn_normal> Content III </span>
<div>
<div id= "show_tab_1" style= "Display:none;" mce_style= "Display:none;" >www.111cn.net Content section The first District </div>
<div id= "show_tab_2" style= "Display:none;" mce_style= "Display:none;" > Content Part II </div>
<div id= "Show_tab_3" style= "Display:none;" mce_style= "Display:none;" > Content Part III </div>
</div>
JS writing a
var zl_ label =function (Obj,classname,contentid) {
if (this.oldobj!=undefined) {
The last Action object style is restored and its associated div is hidden before the first call
This.oldobj.classname=this.oldstyle;
document.getElementById (This.oldcontentid). style.display= ' None ';
}
Perform this (including first) operation
Save this environment first
This.oldobj=obj;this.oldstyle=obj.classname;this.oldcontentid= ContentID;
Set this display
Obj.classname=classname;
document.getElementById (ContentID). style.display= ' block ';
};
Simple wording
function Divswitch (Tarnode, Nodenum) {
var node = document.getElementById (Tarnode);
if (window.activexobject) {
for (var i = 0; i < node.childnodes.length; i++) {
Node.childnodes[i].style.display = "None";
}
Node.childnodes[nodenum].style.display = "block";
} else {
for (var i = 0; i < node.childnodes.length; i++) {
if (Node.childnodes[i].nodetype = = 1 && node.childnodes[i].nodetype!= 3) {
Node.childnodes[i].style.display = "None";
}
}
Node.childnodes[nodenum + 1].style.display = "block";
}
}
Writing with CSS tutorial styles
Function showtab (name, num, n) {
for (i = 1; I <= n; i++) {
var menu = Docu Ment.getelementbyid (name + i);
var con = document.getElementById ("Show_" + name + "_" + i);
menu.classname = i = = num. Name + "_btn_show": Name + "_btn_normal";
con.style.display = i = = num? "Block": "None";
con.classname = i = = num. Name + "_text_show": Name + "_text_normal";
}
}