天天躁日日躁狠狠躁AV麻豆-天天躁人人躁人人躁狂躁-天天澡夜夜澡人人澡-天天影视香色欲综合网-国产成人女人在线视频观看-国产成人女人视频在线观看

Auntion-TableSort javascript類文件第1/2頁

tableSort.class.js
復(fù)制代碼 代碼如下:
/*
*    表格名不能為空,可為已獲取的對象或名字
*    表頭名默認(rèn)為:tag
*    通過自行編寫接口可實現(xiàn)不同的觸發(fā)排序方式
*    
*    作者:Auntion
*    E-mail:Auntion@Gmail.com
*    OICQ:82874972
*    
*    日期:2007年04月22日 - 測試 - 待修正
*/

var tableSort= function(element,tagName,upStyle,downStyle){this.table= (typeof(element) == 'string') ? TAGDom.fromId(element) : element;this.td   = this.table.getElementsByTagName("td");    this.hName= (tagName.length<1) ? "tag" : tagName;this.rows = this.table.rows;this.byUp = (upStyle == undefined) ? "DescUp" : upStyle ;this.byDown = (downStyle == undefined) ? "DescDown" : downStyle ;var totalTd = [];var totalNr = [];var totalTag= [];this.tempCellIndex;    this.tempStatus = {};var setAllTag = function(){                    for(var i = 0; i < this.td.length; i++){if(this.td[i].className === this.hName) totalTag.push(this.td[i]);}}.bind(this);var getStatus = function(tagName){this.tempStatus[tagName] = (this.tempStatus[tagName] == true) ? false : true;for(tags in this.tempStatus){if(tags == tagName) return this.tempStatus[tags];else delete this.tempStatus[tags];}}.bind(this);var changeShow = function(cellIn,status){for(var i=0; i<totalTag.length; i++){if(totalTag[i].cellIndex == cellIn){if(status == true) totalTag[i].className = this.byUp;else if(status == false) totalTag[i].className = this.byDown;}else{totalTag[i].className = this.hName;}}}.bind(this);var startSort = function(status){for (var i = totalNr[this.tempCellIndex].length - 1; i > 0; i--){for (var j = 0; j < i; ++j){if ( (status == true) ? totalNr[this.tempCellIndex][j] > totalNr[this.tempCellIndex][j + 1] : totalNr[this.tempCellIndex][j] < totalNr[this.tempCellIndex][j + 1] ){var temp = totalNr[this.tempCellIndex][j + 1];totalNr[this.tempCellIndex][j + 1] = totalNr[this.tempCellIndex][j];totalNr[this.tempCellIndex][j] = temp;for(var n=0; n<totalNr.length; n++){if(n != this.tempCellIndex){var temps = totalNr[n][j+1];totalNr[n][j + 1] = totalNr[n][j];totalNr[n][j] = temps;}}}}};InsertContect();}.bind(this);var InsertContect = function(){                for(var i=0; i<totalTd.length; i++){for(var j=0; j<totalTd[i].length; j++){totalTd[i][j].innerHTML = totalNr[i][j];}};totalTd.length = 0;totalNr.length = 0;};this.init = function(status){for(var i=0; i<(this.td.length/this.rows.length); i++){totalTd[i] = new Array();totalNr[i] = new Array();for(var j=0; j<this.rows.length; j++){if(this.rows[j].cells[i].className !== this.hName){totalTd[i][j-1] = this.rows[j].cells[i];if(IsNumber(this.rows[j].cells[i].innerHTML) == true){totalNr[i][j-1] = parseInt(this.rows[j].cells[i].innerHTML);}else{totalNr[i][j-1] = this.rows[j].cells[i].innerHTML;}}}}startSort(status);}    

/********************************************************************************************************************************/

/**通過點擊標(biāo)簽觸發(fā)排序事件**/
    //public: 通過默認(rèn)鼠標(biāo)事鍵觸發(fā) (interface example)(設(shè)置用戶接口的范例)
    this.toTagStart = function(){        
        setAllTag();    //獲取標(biāo)簽
        for(var i=0; i<totalTag.length; i++){        
            totalTag[i].sIndex  = function(cIndex){ this.tempCellIndex=cIndex }.bind(this);    //設(shè)置列index
            totalTag[i].gStatus = function(values){ return getStatus(values) };                //獲取與設(shè)置狀態(tài)
            totalTag[i].ceShow  = function(i,s){ changeShow(i,s) };                            //改變顯示的東西
            totalTag[i].stSort  = function(status){ this.init(status) }.bind(this);            //初始化
            totalTag[i].onselectstart = function(){ return false };                //點擊不選中文字
            totalTag[i].onclick = function(){
                this.sIndex(this.cellIndex);
                this.status = this.gStatus(this.firstChild.nodeValue);
                this.ceShow(this.cellIndex,this.status);
                this.stSort(this.status);
            }

        }
    }

}

Language.ext.js
復(fù)制代碼 代碼如下:
/*
*
By Auntion

QQ:82874972

Blog:Auntion@blogbus.com

Email:Auntion@Gmail.com

請勿刪除此部分注釋.謝謝!

ver date-2007-02-01
*
*/
var isIe = /msie/i.test(navigator.userAgent);
var TAGDom = {
    fromId: function(i){
        return document.getElementById(i);
    },
    fromName: function(i){
        return document.getElementById(i);
    },
    fromClass: function(className,baseId) {
        this.fatherId = null;
        if(!baseId){
            this.fatherId = document;
        }else{
            this.fatherId = DOM.fromId(baseId);
        }
        var basic = fatherId.getElementsByTagName("*") || document.all; 
        var child = null;
        var classNames = null;

        var aggregate = []; 
        for (var i = 0; i < basic.length; i++) {
            child = basic[i]; 
            classNames = child.className.split(" "); 
            for (var j = 0; j < classNames.length; j++) {
                if (classNames[j] == className) { 
                    aggregate.push(child); 
                    break; 
                }
            } 
        } 
        return aggregate; 
    }
};
function externalStyle (element, target) {      
    this.setReturn;
    if (element.currentStyle){    
        this.setReturn = element.currentStyle[target];    
    }else if (window.getComputedStyle){
        this.setReturn = getComputedStyle (element,"").getPropertyValue(target);
    }
    return this.setReturn;
}
String.prototype.toInt = function(){
    return parseInt(this.replace(/[a-zA-Z]+/,''));
}
String.prototype.trim = function(){
    return this.replace(/(^/s*)|(/s*$)/g, "");
}
Function.prototype.bind = function(e) {
    var source = this;
    return function() {
        return source.apply(e,arguments);
    }
}
function IsNumber(_str){ 
    var tmp_str = _str.trim(); 
    var pattern = /^(-  ¦/+)?/d+(/d+)?$/;
    return pattern.test(tmp_str);   


使用實例_1.htm

JavaScript技術(shù)Auntion-TableSort javascript類文件第1/2頁,轉(zhuǎn)載需保留來源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請第一時間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 青青青久草| 成人在线小视频 | 91热久久免费频精品99欧美 | 美女被爆羞羞天美传媒 | 在野外被男人躁了一夜动图 | 我的奶头被客人吸的又肿又红 | 沈阳熟女露脸对白视频 | 风月宝鉴之淫乱英雄传 电影 | 夜色55夜色66亚洲精品网站 | 成人国内精品久久久久影 | 亚洲高清国产拍精品5g | 欧美人与动牲交XXXXBBBB免费 | 嫩B人妻精品一区二区三区 内射一区二区精品视频在线观看 | 丰满老熟好大bbbxxx | 最新国自产拍天天更新 | 二色AV天堂在线 | 中文字幕无码他人妻味 | 九九热精品在线观看 | 好紧好湿太硬了我太爽了小说 | 久久免费国产 | 旧里番ovaの催○セイ活指导 | 成人区在线观看免费视频 | 蜜臀久久99精品久久久久久做爰 | 精品久久久亚洲精品中文字幕 | 用震蛋调教女性下面视频 | 亚洲 欧美 国产 综合不卡 | 亚洲欧美日韩一级特黄在线 | 欧美日韩视频一区二区三区 | 欧美一道本一区二区三区 | 国产精品系列在线一区 | 和I儿媳妇激情 | 国产精品免费大片一区二区 | 九色PORNY真实丨国产免费 | 美女胸禁止18以下看 | 影音先锋av男人资源 | 色欲人妻无码AV精品一区二区 | 五花大绑esebdsm国产 | 午夜DY888国产精品影院 | 吉吉影音先锋av资源网 | 午夜dj免费中文字幕 | bl(高h)文|