xsgl.js 890 B

1
  1. $(function(){$(".table1 th").click(function(){var updown=$(this).find(".updown");if(updown.length==0){return}$(this).siblings().find(".updown").html("↑").addClass("auto");if(updown.hasClass("auto")){updown.removeClass("auto");sort($(this).index(),1);return}if(updown.html()=="↑"){updown.html("↓");sort($(this).index(),-1)}else{updown.html("↑");sort($(this).index(),1)}});$(".tablecj").click(function(){return false}).change(function(){var arr=$(".table1 tr:gt(0)");var key=this.value;arr.each(function(){if(key=="-1"){$(this).show();return}if($(this).find("td").eq(2).html()==key){$(this).show()}else{$(this).hide()}})})});function sort(index,type){var arr=$(".table1 tr:gt(0)");arr=arr.sort(function(a,b){var val1=$(a).find("td").eq(index).text();var val2=$(b).find("td").eq(index).text();if(type==1){return val1>val2}else if(type==-1){return val1<val2}});$(".table1").append(arr)}