JavaScriptʵ�ֶ�ά��������ֵ����
����javascript�������������� sort������Ĭ���ǰ���ASCII �ַ�˳�������������С�
����arrayobj.sort(sortfunction);
����������sortFunction
������ѡ�������ȷ��Ԫ��˳���ĺ��������ơ���������������ʡ�ԣ���ôԪ�ؽ����� ASCII �ַ�˳�������������С�
����sort ������ Array ���������ʵ�����������ִ�й����в����ᴴ���µ� Array ������
��������Ϊ sortfunction �����ṩ��һ����������ô�ú������뷵������ֵ֮һ��
������ֵ�����������ݵĵ�һ�������ȵڶ�������С��
�����㣬���������������ȡ�
������ֵ��������һ�������ȵڶ�����������
�������ϵķ�����һά���������Ǻܷ����ģ�����SQL�����е�ORDER BY һ���Ķ���ֵ��������ô���أ�
������ά�����Ķ���ֵ����������Ҫ����һЩ��������Ҫ��ѭ��������ʵ�ʽ����ĵ�����һ���� ��
�������֣�
�������µ������ǽ����ֵĶ�ά���鰴�յ�5�У���9�У���3�е�˳����������SQL�����е�ORDER BY col5��col9��col7�����ֵ�ʱ������ֱ��������Ŀ�������Խ�����Ϊ����ֵ���ɡ�
<script language=javascript>
����var myArray = new Array();
����for(var i=0;i<10;i++ )...{
��������myArray[i]=new Array();
��������myArray[i][0]=Math.floor(Math.random()*10);��������
��������myArray[i][1]=Math.floor(Math.random()*10);
��������myArray[i][2]=Math.floor(Math.random()*10);
��������myArray[i][3]=Math.floor(Math.random()*10);
��������myArray[i][4]=Math.floor(Math.random()*10);
��������myArray[i][5]=Math.floor(Math.random()*10);
��������myArray[i][6]=Math.floor(Math.random()*10);
��������myArray[i][7]=Math.floor(Math.random()*10);
��������myArray[i][8]=Math.floor(Math.random()*10);
����}
����
����myArray.sort( function(x, y) ...{
��������return (x[0]==y[0])?((x[4]==y[4])?(x[8]-y[8]):(x[4]-y[4])):(x[2]-y[2])
����});
����for(var i=0;i<myArray.length;i++ )...{
��������document.write(myArray[i].join(",") + "<br/>");
����}
</script>
�����ַ���
�����ַ���ʱ��sortFunction�е���Ŀ����������һ��ֱ����������Ҫ����
����str1.localeCompare( str2 )���������Ƚϣ��Ӷ����㷵��ֵ�������Ƕ�ά�����ĵ�1��2����������������
function sortFunction(array) ...{
����return array.sort( function(x, y) ...{
����return (x[0]==y[0])?(x[1].localeCompare(y[1])):(x[0].localeCompare(y[0]))
����});
}
��������arrayObject.sort( sortFunction )���������ܻ��Ǻ�ǿ���ģ������ܹ�ʵ����SQL�����е�ORDER BY һ���Ĺ��ܡ�
- ת����ע����Դ��ITѧϰ�� ��ַ��http://www.t086.com/ �����������Ƽ�������
- �ر������� ��վ�������ر�������ֹת�ص�ר�������������¿�������ת�أ���������ע��������ԭʼ���ߡ����°�Ȩ������ԭʼ�������С����ڱ���վת�����µĸ��˺���վ�����DZ�ʾ������л�⡣������վת�ص������а�Ȩ��������ϵ���ǣ����ǻᾡ�����Ը�����
- �������е���ɫ
- �������ж�IP��ַ��A��B���C��
- ������ϵ��Ц�� (ʷ����ȫ��
- ��Google���������ŵ���ͨv4.0
- ���ٶ�ͳ��URL��hm������utm�����Ķ�Ӧ��ϵ
- ��ƻ������MACbook Air���ݼ���ȫ
- ��Linux��ʹ��host��dig��nslookup��ѯDNS
- ���������ԡ���װ Windows XP ����ϵͳ��ͼ��ȫ����
- �����Լ���VPS�Google��������
- ��С�ڴ�VPS֮Nginx+PHP-fpm�߸����Ż���ѹ�����Է���