循环显示切换

 1 //列表显示

 2             function openP(_id)

 3                 {

 4                    var select_id = parseInt(_id.replace("month",""));

 5                    for (i=1;i<=4;i++)

 6                    {

 7                       if (i==select_id)

 8                       {

 9                           document.getElementById("month"+i).style.display = "block";

10                       }

11                       else

12                       {

13                          document.getElementById("month"+i).style.display = "none";

14                       }

15                    }

16                 }

调用方法:

1 <a href="javaScript: ;" onmouseover="openP('month1')"></a>

2                     <a href="javaScript: ;" onmouseover="openP('month2')"></a>

3                     <a href="javaScript: ;" onmouseover="openP('month3')"></a>

4                     <a href="javaScript: ;" onmouseover="openP('month4')"></a>

 

你可能感兴趣的:(循环)