如:第一个是姓名 ,第二个是 手机 第三个是邮箱
testArray[0]= new Array('张三','1314662544','[email protected]');
testArray[1]= new Array('aa','1331154647','[email protected]');
testArray[2]= new Array('李四','132112154','[email protected]''); ....testArray[i]= new Array('王六','139111122','[email protected]');
点击姓名时候
排序为
testArray[0]= new Array('aa','1331154647','[email protected]');
testArray[1]= new Array('李四','132112154','[email protected]'');
...
testArray[3]= new Array('王六','139111122','[email protected]');testArray[i]= new Array('张三','1314662544','[email protected]');姓名:按照姓名音序a-z进行排序。同一音序下,先显示英文姓名,再显示中文姓名手机:按照手机数字0-9进行排序私人邮箱:按照大写字母(A-Z)、小写字母(a-z)进行排序
testArray[0]= new Array('张三','1314662544','[email protected]');
testArray[1]= new Array('aa','1331154647','[email protected]');
testArray[2]= new Array('李四','132112154','[email protected]''); ....testArray[i]= new Array('王六','139111122','[email protected]');
点击姓名时候
排序为
testArray[0]= new Array('aa','1331154647','[email protected]');
testArray[1]= new Array('李四','132112154','[email protected]'');
...
testArray[3]= new Array('王六','139111122','[email protected]');testArray[i]= new Array('张三','1314662544','[email protected]');姓名:按照姓名音序a-z进行排序。同一音序下,先显示英文姓名,再显示中文姓名手机:按照手机数字0-9进行排序私人邮箱:按照大写字母(A-Z)、小写字母(a-z)进行排序
解决方案 »
- slideToggle 和toggle 用法上有什么区别呢
- 初学者一个关于十进制数转换为十六进制字符串的问题
- 等待中 急求高手指点 jsp分页操作 为什么老是提示空指针
- 问一个简单的问题,请大家原谅
- Flash图片切换,就是很多网站的图片新闻的那种,下面有1234的
- 帮忙,看一个HTC的简单问题
- (急)简单问题,select下拉列表,如何选中自动提交form表单
- 高手才进来,关于window.HttpXmlRequest的问题
- Netscape 与 IE 中js的问题?
- attachEvent()中如何传递参数?
- 二级选单选中某一项显示隐藏Input
- 把这段code的秒钟、分钟和时钟的个位数变成两位数
var arr = [['张三','1314662544','[email protected]'], ['aa','1331154647','[email protected]'], ['李四','132112154','[email protected]'], ['王六','139111122','[email protected]']];
function arrSorting(o){
o == 0 ? arr.sort(function(x, y){
return x[0].localeCompare(y[0])
})
: o == 1 ? arr.sort(function(x, y){
return x[2] > y[2] ? 1 : -1
})
: arr.sort();
return arr
}
</script>
<input type=button value="按姓名排序" onclick="alert(arrSorting(0))">
<input type=button value="按邮箱排序" onclick="alert(arrSorting(1))">