排他算法---应用于轮播图小圆点

//===============排他算法(应用轮播图小圆点)===========
        var opp = document.getElementById("box1").getElementsByTagName("p");

        //for循环为每个小圆点添加监听
        for(var i=0;i<=opp.length;i++){

            //绑定onmouseover事件
            opp[i].onmouseover=function(){

                //先把所有的小圆点变为灰色
                for(var j=0;j<opp.length;j++){

                    opp[j].style.backgroundColor="#ccc";

                }
                //再让自己变红
                this.style.backgroundColor="red";
            }
        }
原文地址:https://www.cnblogs.com/lshdashi/p/9539749.html