JS Application Example--tab

Source: Internet
Author: User

<div id= "Wai" >
<div id= "Gy" >

This is a 3 option. Click on the option to achieve the conversion of the following three Div.
<div class= "Gy_head" style= "color: #999" guanlian= "one" > Join us </div>
<div class= "Gy_head" guanlian= "the other" > Contact us </div>
<div class= "Gy_head" guanlian= "three" > Learn more </div>
</div>

This is the first Div (one)
<div id= "Neirong" >
<div class= "Neirong" id= "one" ><div id= "Nr_first_datu" ></div><div id= "Nr_first_wz" >
People are our most important asset, we are open-minded, welcome you to join! </div><div id= "Nr_first_zp" > go to Recruitment home </div>

This is a second div.

</div> <div class= "Neirong" id= "" "><div id=" Nr_second_datu "></div><div id=" nr_ Second_wz1 "><div id=" Nr_second_wone "
<div id= "Nr_second_wtwo" > <div id= "NR_SECOND_WZ2" > <div class= "Nr_second_wz_two" > <div class= "Nr_second_wz_two" >

A third
<div class= "Neirong" id= "three" ><div id= "Nr_three_datu" ></div><div id= "Nr_three_nr" >

<ul><li class= "Nr_li" ><div class= "Nr_xiaotu" ></div></li><div class= "Ling" ><span class= "NR_XIAOTU_WZ" > Latest News </span ></div>

<li class= "Nr_li"; <div calss= "nr_ Xiaotu "> </DIV> </LI> < Div class= "Ling" ><span class= "Nr_xiaotu_wz" > Promotional video </span></div>

<li class= "Nr_li" ><div calss= "Nr_xiaotu" ></div></li><div class= "Ling" ><span class= "NR_XIAOTU_WZ" > Humanistic care </span></div><li class= "Nr_li" ><div calss= "Nr_xiaotu" >< /div></li><div class= "Ling" ><span class= "NR_XIAOTU_WZ" > Industry Report </span></div></ul ></div></div></div></div>

Here is the JS

var gy = document.getelementsbyclassname ("Gy_head");//Get Three tab class
for (Var i=0;i<gy.length;i++)

{//More than one must have a For loop
Gy[i].onclick = function () {                    &N Bsp  //three tabs plus click events
                            nbsp         for (Var i=0;i<gy.length;i++) {//Make tab font or background color constant
                                       gy[i].style.color = "Blac K ";//This is the first onclick

to implement

}
This.style.color = "#999";//The Color of the click
var se = this.getattribute ("Guanlian");//This method is used to find the respective div below the associated tab
var nr = document.getelementsbyclassname ("Neirong"); Find Div
for (Var i=0;i<nr.length;i++) {Nr[i].style.display = "none";}
Let the corresponding div implement the Click Effect document.getElementById (SE). style.display = "block";
}
}

JS Application Example--tab

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.