The home page of the student's website has 19 repeater controls. Switch the tabs of the six Div blocks.
For tabs switching, you cannot write one by one :(CodeAs follows ....)Copy codeThe 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 ("Div"). 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 Copy code The Code is as follows: <Div class = "sh_topnew">
<Div class = "w1bg"> </div>
<Div id = "tabs">
<Li> <Div class = "w1bg"> </div> <a href = "list. aspx? Uid = 185 "> News </a> <Div class =" w1bg "> </div> </LI>
<Li> <Div class = "w1bg"> </div> <a href = "list. aspx? Uid = 160 "> group study </a> <Div class =" w1bg "> </div> </LI>
</Div>
<Div class = "w1bg"> </div>
<Div class = "w636">
<Div class = "w300"> </div>
<Div class = "w336" id = "ul_tabs"> <ul> </ul> <ul class = "nodis">
<Li> <a href = "show. aspx? Uid = 194 & id = 6393 "Title =" "> [] </a> 2010-05-17 </LI>
<Li> <a href = "show. aspx? Uid = 193 & id = 6392 "Title =" Our Youth League Committee conducts main activities of style study construction "> [Group Day activities] Our Youth League Committee conducts main activities of style study construction </a> 2010-05-17 </LI>
</Ul> </div>
</Div>