当前位置: 代码迷 >> Web前端 >> 选入选项卡
  详细解决方案

选入选项卡

热度:183   发布时间:2012-11-22 00:16:41.0
选中选项卡

?? function activeMenu(){

?? ??var c? =arguments.length==1?arguments[0]:"on";?? ??
? ??var url =document.location.href;
? ??if(url.indexOf("thisPage")!=-1){
???url= url.substr(0,url.indexOf("&thisPage"));
??}
??$("a").each(???
???function () {
?????var thref =this.href;
?????if(thref.indexOf("#")!=-1){
???? ???thref = thref.substr(0,thref.indexOf("#"));
???? ??}?? ??
????if(url.indexOf(thref)!=-1){
?????$(this).parent().addClass(c);
?????//$(this).parent().attr("id",c);
?????
????}?? ???
???});
?}
?

  相关解决方案