The homepage of the student section has 19 repeater controls. 6 div block tabs switch.
Do tabs switch can not write the way one by one: (code as follows ...)
Copy Code code 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+ "a");
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 23 row assignment uses the jquery index method. Finds the index value of an element of an object in this object.
Official One note: $ (' Li '). Index ($ (' #bar '); Here the index argument is in single quotes. Always fails during the test. Don't know why. Later, we define the object of $ (this) directly: Var arra=$ ("#" +ab+ "a");.
You can successfully return the index.
Here is one of the tabs
Copy Code code 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 dynamic </a><div class=" W1BG "></div></li>
<li><div class= "W1BG" ></div><a href= "list.aspx"? uid=160 "> Group special Work </a><div class=" W1BG "></div></li>
</div>
<div class= "W1BG" ></div></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=" Regiment Dry Training Notice ">[Regiment Dry Training" Regiment dry training notice </a>2010-05-17</li>
<li><a href= "Show.aspx? uid=193&id=6392 "Title=" The Communist Youth League of our school to carry out the main activities of the construction of study atmosphere ">[Pourges activities]" The Communist Youth League of our school construction main activities </a>2010-05-17</li>
</ul></div>
</div>