爱易网
IT新闻
IT新闻
爱易资讯
网站搭建
云虚拟主机教程
云服务器教程
Apache教程
IIS教程
Nginx教程
网站策划
站长文章
推广教程
淘宝客教程
网页设计
HTML教程
XHTML教程
CSS教程
HTML5教程
CSS3教程
JavaSript基础
JQuery教程
Node.js教程
前端技术
Ajax教程
Js特效
Xml教程
平面设计
页面UI设计
photoshop教程
程序开发
AI人工智能
Asp教程
Php教程
Asp.Net教程
Net Core教程
C#教程
Java教程
Jsp教程
开发技术
微信小程序教程
Uniapp开发教程
微信公众号开发
Andriod教程
IOS教程
DOS教程
Python教程
Docker教程
Windows Container教程
数据库
MSSQL教程
MySQL教程
Redis教程
Access教程
Oracle教程
数据库教程
操作系统
Linux教程
Windows教程
MAC教程
Cisco教程
交换机教程
防火墙教程
搜索
爱易网页
JS特效
不错的表格排序
不错的表格排序
日期:2014-05-18 浏览次数:20219 次
以下是程序代码
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <meta name="keywords" content="站长,网页特效,js特效,广告代码,zzjs,zzjs.net,sky,www.zzjs.net,站长特效 网" /> <meta name="description" content="www.zzjs.net,站长特效网,站长必备js特效及广告代码。大量高质量js特效,提供高质量广告代码下载,尽在站长特效网" /> <title>非常不错的表格排序,sky整理收集,站长特效欢迎您。</title> </head> <STYLE type=text/css>TABLE { BORDER-RIGHT: #000000 2px solid; BORDER-TOP: #000000 2px solid; BORDER-LEFT: #000000 2px solid; BORDER-BOTTOM: #000000 2px solid; 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; PADDING-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 } TH A { COLOR: #000080; TEXT-DECORATION: none } TH A:visited { COLOR: #000080 } TH A:active { COLOR: #800000; TEXT-DECORATION: underline } TH A:hover { COLOR: #800000; TEXT-DECORATION: underline } TR.alternateRow { BACKGROUND-COLOR: #e0e0e0 } TD.sortedColumn { BACKGROUND-COLOR: #f0f0f0 } TH.sortedColumn { BACKGROUND-COLOR: #b0b0b0 } TR.alternateRow TD.sortedColumn { BACKGROUND-COLOR: #d0d0d0 } </STYLE> <SCRIPT type=text/javascript> function sortTable(id, col, rev) { // Get the table or table section to sort. var tblEl = document.getElementById(id); // The first time this function is called for a given table, set up an // array of reverse sort flags. if (tblEl.reverseSort == null) { tblEl.reverseSort = new Array(); // Also, assume the team name column is initially sorted. tblEl.lastColumn = 1; } // If this column has not been sorted before, set the initial sort direction. if (tblEl.reverseSort[col] == null) tblEl.reverseSort[col] = rev; // If this column was the last one sorted, reverse its sort direction. if (col == tblEl.lastColumn) tblEl.reverseSort[col] = !tblEl.reverseSort[col]; // Remember this column as the last one sorted. tblEl.lastColumn = col; // Set the table display style to "none" - necessary for Netscape 6 // browsers. var oldDsply = tblEl.style.display; tblEl.style.display = "none"; // Sort the rows based on the content of the specified column using a // selection sort. var tmpEl; var i, j; var minVal, minIdx; var testVal; var cmp; for (i = 0; i < tblEl.rows.length - 1; i++) { // Assume the current row has the minimum value. minIdx = i; minVal = getTextValue(tblEl.rows[i].cells[col]); // Search the rows that follow the current one for a smaller value. for (j = i + 1; j < tblEl.rows.length; j++) { testVal = getTextValue(tblEl.rows[j].cells[col]); cmp = compareValues(minVal, testVal); // Negate the comparison result if the reverse sort flag is set. if (tblEl.reverseSort[col]) cmp = -cmp; // Sort by the second column (team name) if those values are equal. if (cmp == 0 && col != 1) cmp = compareValues(getTextValue(tblEl.rows[minIdx].cells[1]), getTextValue(tblEl.rows[j].cells[1])); // If this row has a smaller value than the current minimum, remember its // position and update the current minimum value. if (cmp > 0) { minIdx = j; minVal = testVal; } } // By now, we have the row with the smallest value. Remove it from the // table and insert it before the current row. if (minIdx > i) { tmpEl
上一篇:狡猾的按钮特效
下一篇:可随意拖动的表格
免责声明:
本文仅代表作者个人观点,与爱易网无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
相关资料
更多>
乐视28日发布手机进展 LeUI系统Mobile版或曝光
公信力消失:马航事件社交媒体传播之痛
诺基亚仍是第二大手机商:功用机有利可图
优酷土豆携手新浪微博 谋攻移动视频失地
众贷网满月开张 网络金融监管再受质疑
SAP高层调整:联席CEO孟鼎铭成唯一掌舵人
运营商补贴减少 国内通信业拐点逼近
高通反垄断案下月有望落定
谷歌董事长成花花公子:情史足以媲美涂鸦
推荐阅读
更多>
新闻早8点》Facebook失手发布Snapchat类应用
Facebook以“人”为本的名义占领安卓
手游市场乱象丛生 受资本热捧野蛮成长
苹果售后生态链乱象:供需失衡价钱不一
三大运营商获通知大减营销费 传3年减400多亿
中移动五大基地将整改成公司:被指易滋生腐败
中移动推动感地带3G网聊卡 火拼微信沃卡
广东移动高层受调查 中移动或现更大反腐风暴
说说这一个月的赌球输了多少
广东移动董事长徐龙受调查 圈内对其褒贬不一
不提老罗,不说情怀,仅从十四个投诉问题入手谈锤子手机
纸媒深探版权蓝海抗衡互联网的时机到来了
魅族黄章惹怒芙蓉姐姐 将跨界推女神手机
微信企业号必须搬走四座大山,否则只能铩羽而归!
苹果大中华区业绩回暖 中移动贡献或低于预期
广电总局回应美剧下架:不是所有信息可公开
中国手游总裁及8名高管集体下岗,被指涉不当交易
网曝富士康500万iphone遭退货是确证的事
陈天桥之鉴:产品创新被扼杀那些事
微软与摩托罗拉授权协议涵盖Android和Chrome设备