There are many ways to select a card switch. There is no definite method. The charm of a program lies in the fact that there are countless [Methods] to implement a [Result. The home page of the student's website has 19 Repeater controls. Switch between the six p blocks.
You cannot write the tabs switch one by one: (the Code is as follows ....)
The Code is as follows:
$ (Function ()
{
$ ("# Tabs a: eq (0), # tabs2 a: eq (0), # dbt_l_t_tabs a: eq (0), # dbt_r_t_tabs a: eq (0) "). addClass ("m_on ");
$ ("# Tabs a: gt (0), # tabs2 a: gt (0), # dbt_l_t_tabs a: gt (0), # dbt_r_t_tabs a: gt (0) "). addClass ("m_out ");
$ ("# Tabs a, # tabs2 a, # dbt_l_t_tabs a, # dbt_r_t_tabs a"). each (function (){
$ (This). mouseover (function (){
If ($ (this). hasClass ("m_out "))
{
Var AB = $ (this). closest ("li"). closest ("p"). attr ("id ");
Var ulid = "ul _" + AB;
Var arra = $ ("#" + AB + "");
Var e = arra. index ($ (this ));
$ ("#" + AB + "a"). removeClass ("m_on"). addClass ("m_out ");
$ (This). removeClass ("m_out"). addClass ("m_on ");
$ ("#" + Ulid + "ul"). hide ();
$ ("#" + Ulid + "ul: eq (" + e + ")"). show ();
}
})
})
})
The index method of JQuery is used to assign values to the 23 rows. Search for the index value of an element of an object in this object.
An official note: $ ('lil'). index ($ ('# bar'); here, the index parameter is enclosed in single quotes. Always fails during the test .. I don't know why. Then, the object where $ (this) is located is defined: var arra = $ ("#" + AB + "");.
You can return the index successfully.
Here is a Tabs
The Code is as follows:
News
Special Group work
- [Group Cadre Training] group Cadre Training notice 2010-05-17
- [Group day activity] the Youth League Committee of our school held the subject activity of Style Building