Home > front end >  Which bosses told me that a paragraph about what ah, very urgent
Which bosses told me that a paragraph about what ah, very urgent

Time:12-21

<script>

The function of $(id) {
Return typeof id==='string'? Document. The getElementById (id) : id;
}
Var titles=$(" notice - tit "). The getElementsByTagName (" li ");
Var divs=$(" notice - con "). The getElementsByTagName (" div ");
for(var i=0; iTitles [I] index=I;
Titles [I] onm ouseover=function () {
For (var j=0; jTitles [j]. Journal of className="";
Divs [j] style. The display="none";
}
Enclosing the className="tab_current";
Divs [this index]. Style. The display="block";
};

};

</script>

CodePudding user response:

<script>

The function $(id) {//transfer an id, enclosed document.
getElementById methodReturn typeof id==='string'? Document. The getElementById (id) : id;//figure out whether variable id string type, so, according to the id, access to objects, not directly return variable id
}
Var titles=$(" notice - tit "). The getElementsByTagName (" li ");//get notice - all tile object under li
Var divs=$(" notice - con "). The getElementsByTagName (" div ");//get all the div of notice - con
for(var i=0; iTitles [I] index=I;
Titles [I] onm ouseover=function () {//mouse across events, slip into the corresponding li, remove the style of li, hidden for div
For (var j=0; jTitles [j]. Journal of className="";
Divs [j] style. The display="none";
}
Enclosing the className="tab_current";//set the style of li to tab_current
Divs [this index]. Style. The display="block";//display the corresponding div
};

};

</script>

CodePudding user response:

This you can also write a test program, using this method, take a look at will know that what is the function

CodePudding user response:

refer to the second floor usecf response:
this you can also write a test program, using this method, take a look at will know that what function the

What's the use of this code is specific?

CodePudding user response:

Is actually a according to navigation mouse-over corresponds to the content, classification of goods similar to the shopping mall
  • Related