欢迎来到天天文库
浏览记录
ID:12597021
大小:84.50 KB
页数:14页
时间:2018-07-18
《具备排序功能的表格(js+css+table)》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、具备排序功能的表格(JS+CSS+table)-TABLE{BORDER-RIGHT:#0000002pxsolid;BORDER-TOP:#0000002pxsolid;BORDER-LEFT
2、:#0000002pxsolid;BORDER-BOTTOM:#0000002pxsolid;border-spacing:0px;cell-spacing:0px}TD{PADDING-RIGHT:0.5em;PADDING-LEFT:0.5em;FONT-SIZE:10pt;PADDING-BOTTOM:2px;PADDING-TOP:2px;FONT-FAMILY:Arial,Helvetica,sans-serif;WHITE-SPACE:nowrap}TH{PADDING-RIGHT:0.5em;PADDING-LEFT:0.5em;FONT-SIZE:10pt;PADD
3、ING-BOTTOM:2px;PADDING-TOP:2px;FONT-FAMILY:Arial,Helvetica,sans-serif;WHITE-SPACE:nowrap}TD.numeric{TEXT-ALIGN:right}TH{BACKGROUND-COLOR:#c0c0c0}TH.mainHeader{COLOR:#ffffff;BACKGROUND-COLOR:#808080;TEXT-ALIGN:left}THA{COLOR:#000080;TEXT-DECORATION:none}THA:visited{COLOR:#000080}THA:active{COLO
4、R:#800000;TEXT-DECORATION:underline}THA:hover{COLOR:#800000;TEXT-DECORATION:underline}TR.alternateRow{BACKGROUND-COLOR:#e0e0e0}TD.sortedColumn{BACKGROUND-COLOR:#f0f0f0}TH.sortedColumn{BACKGROUND-COLOR:#b0b0b0}TR.alternateRowTD.sortedColumn{BACKGROUND-COLOR:#d0d0d0}5、script>//-----------------------------------------------------------------------------//sortTable(id,col,rev)////id-IDoftheTABLE,TBODY,THEADorTFOOTelementtobesorted.//col-Indexofthecolumntosort,0=firstcolumn,1=secondcolumn,//etc.//rev-Iftrue,thecolumnissortedinreverse(descending)order//initial6、ly.////Note:theteamnamecolumn(index1)isusedasasecondarysortcolumnand//alwayssortedinascendingorder.//-----------------------------------------------------------------------------functionsortTable(id,col,rev){//Getthetableortablesectiontosort.vartblEl=document.getElementById(id);//Thefirsttimet7、hisfunctioniscalledforagiventable,setupan//arrayofreversesortflags.if(tblEl.reverseSort==null){tblEl.reverseSort=newArray();//Also,assumetheteamnamecolumnisinitiallysorted.tblEl.lastColumn=1;}//Ifthiscolumnhasnotbeensortedbefore,setthei
5、script>//-----------------------------------------------------------------------------//sortTable(id,col,rev)////id-IDoftheTABLE,TBODY,THEADorTFOOTelementtobesorted.//col-Indexofthecolumntosort,0=firstcolumn,1=secondcolumn,//etc.//rev-Iftrue,thecolumnissortedinreverse(descending)order//initial
6、ly.////Note:theteamnamecolumn(index1)isusedasasecondarysortcolumnand//alwayssortedinascendingorder.//-----------------------------------------------------------------------------functionsortTable(id,col,rev){//Getthetableortablesectiontosort.vartblEl=document.getElementById(id);//Thefirsttimet
7、hisfunctioniscalledforagiventable,setupan//arrayofreversesortflags.if(tblEl.reverseSort==null){tblEl.reverseSort=newArray();//Also,assumetheteamnamecolumnisinitiallysorted.tblEl.lastColumn=1;}//Ifthiscolumnhasnotbeensortedbefore,setthei
此文档下载收益归作者所有