怎样用jQuery写这段代码

window.onload=function(){

            var oUl=document.getElementById('oUl');

            var aLi=oUl.children;


            for(var i=0;i<aLi.length;i++){

                aLi[i].index=i;

                aLi[i].onmouseover=function(){

                    for(var i=0;i<aLi.length;i++){

                        if(this.index>=i){

                            aLi[i].className='ac';

                        }else{

                            aLi[i].className='';

                        }

                    }

                };

            }


        } 


噜噜哒
浏览 505回答 1
1回答

繁星coding

$("#oUL li").click(function(){&nbsp; &nbsp; $(this).attr("class", "ac")&nbsp; &nbsp; &nbsp; &nbsp; .siblings()&nbsp; &nbsp; &nbsp; &nbsp; .attr("class", "")})
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript