JS排序

[复制链接]
查看11 | 回复6 | 2017-9-26 13:06:30 | 显示全部楼层 |阅读模式
//=========================================================
//
//在本机???器?面表格中的数据行?行排序的javascript函数
//
//author WilliamQQ: 22967225
//create date 2005-12-2
//version 1.0
//=========================================================
//column index for sort
var indexCol;
//比?函数,用于Array.sort()排序?比?用。
//本函数比?数?元素array1[indexCol]和元素array2[indexCol]Unicode?的大小
function arrayCompare(array1,array2){
c = array1[indexCol].indexOf("href");
if(c== -1){

c=convert1(array1[indexCol]);
} else {
c = array1[indexCol].indexOf(">");
c=convert1(array1[indexCol].substring(c+1 ));
}

d = array2[indexCol].indexOf("href");
if(d== -1){
d = convert1(array2[indexCol]);
} else {
d =array2[indexCol].indexOf(">");
d =convert1(array2[indexCol].substring(d+1 ));
}


if (cd)
return 1;
return 0;

}

//与arrayCompare相反方式比?大小,用于倒序使用
function arrayCompareRev(array1,array2){
c = array1[indexCol].indexOf("href");
if(c== -1){
c=convert1(array1[indexCol]);
} else {
c = array1[indexCol].indexOf(">");
c=convert1(array1[indexCol].substring(c+1 ));
}

d = array2[indexCol].indexOf("href");
if(d== -1){
d = convert1(array2[indexCol]);
} else {
d =array2[indexCol].indexOf(">");
d=convert1(array2[indexCol].substring(d+1 ));
}
if (cd)
return -1;
return 0;
}

//define a 2-dimension array
function BiArray(rows,cols){
//simulate multidimension array
this.rows = rows;
this.cols = cols;
//construct array
var lines = new Array(rows);
for(var i = 0;i = 65377 && c = 65398 && c = 65418 && c = 12353 && c <= 12435) || c == 12445 || c == 12446); }
function toZenKdata2(src) {
return src.replace(/(\w)/g,
function ($0) {
return String.fromCharCode($0.charCodeAt(0) + 65248);
});
}
function toZenKdata1(src) {
var i, code, next;
var str = new String;
var len = src.length;
for (i = 0; i < len; i++) {
var c = src.charCodeAt(i);
if (iskana(c)) {
code = zen_table[c - 65377];
if (i < len - 1) {
next = src.charCodeAt(i+1);
if (next == 65438 && c == 65395) {

code = "ヴ";

i++;
} else if (next == 65438 && (is_ka_to(c) || is_ha_ho(c))) {

code = String.fromCharCode(code.charCodeAt(0)+1);

i++;
} else if (next == 65439 && is_ha_ho(c)) {

code = String.fromCharCode(code.charCodeAt(0)+2);

i++;
}
}
str += code;
} else if (is_hira(c)) {
str += String.fromCharCode(c + 96);
} else {
str += src.charAt(i);
}
}
return str;
}
function convert1(inidata) {
var src1 = new String(inidata);
var src2 = new String;
var src3 = new String;
var result = new String;
src2 = toZenKdata1(src1);
src3 = toZenKdata2(src2);
result = src3.toUpperCase();
return result;
}

///////////////////////////////
ヒョウさん:
06170806.rarの内部のファイルは、一部のチェックIDはまだ無し、また正しくない状態です。
自分で修正してください。
//////////////////////////////
[ 本帖最后由 fener1028 于 2009-7-9 08:20 编辑 ]
回复

使用道具 举报

千问 | 2017-9-26 13:06:30 | 显示全部楼层
lz原创?
回复

使用道具 举报

千问 | 2017-9-26 13:06:30 | 显示全部楼层
innerHtml部分不是原创,其他部分是。因为太忙,整个函数没有写清楚,等到星期六和星期天我把它的用法和解释写清楚。不好意思啊。随便就发上来。
回复

使用道具 举报

千问 | 2017-9-26 13:06:30 | 显示全部楼层
支持lz,支持原创
回复

使用道具 举报

千问 | 2017-9-26 13:06:30 | 显示全部楼层
支持lz,支持原创
回复

使用道具 举报

千问 | 2017-9-26 13:06:30 | 显示全部楼层
支持原创,不过这里面咋连日语都出来了
回复

使用道具 举报

千问 | 2017-9-26 13:06:30 | 显示全部楼层
lz总结的不错
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行