<script> <BR>var listInfos = new Array(); <BR>listInfos[0] = new Array(); <BR>listInfos[0][0] = {'name':'推薦頁1',' DayCount':666,'AvgTime':29872,'ErrCount':180663,'ErrorRate':'2873%','DaySystemErrorCount':0,'DaySystemrErrorRate':'0%'} <BR>Infos[00][100][ ] = {'name':'推薦頁2','DayCount':593896,'AvgTime':24946,'ErrCount':222,'ErrorRate':'2%','DaySystemErrorCount':0,'DaySystemrErrorRate': '0%'} <BR>listInfos[0][2] = {'name':'推薦頁3','DayCount':956,'AvgTime':27957,'ErrCount':111,'ErrorRate':' 10%','DaySystemErrorCount':0,'DaySystemrErrorRate':'0%'} <BR>listInfos[1] = new Array(); <BR>listInfos[1][0] = {'name':'推薦頁4','DayCount':666,'AvgTime':116,'ErrCount':180663,'ErrorRate':'2873%','DaySystemErrorCount':0,'DaySystemrErrorRate':'0%'} <BR>list [1][1] = {'name':'推薦頁5','DayCount':11,'AvgTime':222,'ErrCount':222,'ErrorRate':'2%','DaySystemErrorCount':0 ,'DaySystemrErrorRate':'0%'} <BR>listInfos[1][2] = {'name':'推薦頁6','DayCount':956,'AvgTime':956,'ErrCount':111, 'ErrorRate':'10%','DaySystemErrorCount':0,'DaySystemrErrorRate':'0%'} <BR>function dateDesc(listInfos,field){ <BR>for( var i=0; i < listInfos.length ; i ){ <BR>for( var j = i 1 ; j < listInfos.length ; j ){ <BR>if( isCommaPercent(listInfos[i][field]) < isCommaPercent(listInfos[j][field]) ){ <BR>var arrayTemp = new Array(); <BR>arrayTemp = listInfos[i]; <BR>listInfos[i] = listInfos[j]; <BR>listInfos[j] = arrayTemp; <BR><br>} <br>} <BR>return listInfos; <BR>} <BR>function dataAsc(listInfos,field){ <BR>for( var i=0; i < listInfos.length ; i ) { <BR>for( var j = i 1 ; j < listInfos.length ; j ){ <BR>if( isCommaPercent(listInfos[i][field]) > isCommaPercent(listInfos[j][field]) ){ <BR>var arrayTemp = new Array(); <BR>arrayTemp = listInfos[i]; <BR>listInfos[i] = listInfos[j]; <BR>listInfos[j] = arrayTemp; <BR>} <BR>listInfos[j] arrayTemp; <br>} <br>} <BR>return listInfos; <BR>} <BR><br>function isCommaPercent(value){ <br>var valueFloat; <BR>value = value = valueFloat = ( value.indexOf(',') > 0 )? value.split(',').join(''):value; <BR>valueFloat = (valueFloat.indexOf('%') > 0)? 。 ,field,sort){ <BR>var listInfos = new Array(); <BR>if( sort == 'desc' ){ <BR>for(var i=0; i < sortInfos.length ; i ){ <BR>listInfos[i] = dateDesc(sortInfos[i],field); <br>} <br>}else if( sort == 'asc' ){ <br>for(var i=0; i < sortInfos. length ; i ){ <br>listInfos[i] = dataAsc(sortInfos[i],field); <BR>} <BR>}else{ <BR>alert('操作錯誤...'); <BR> return false; <BR>} <BR><BR>var tableStrList =''; <BR>for( var i=0; i < listInfos.length ; i ){ <BR>var tableStr='<h1>程式< /h1>'; <BR>tableStr = '<table width="100%" cellspacing="0" cellpadding="0" border="1" class="programTabble"><tbody><tr class="indexTableTr" >'; <BR>tableStr ='<td width="16%">程式名稱<td width="14%">當天造訪量(次)<td width="14% ">平均反應時間(us)<td width="14%">錯誤數(次)'; <BR>tableStr ='<td width="14%">錯誤率( %) <td width="14%">系統錯誤數(次) <td width="14%">系統錯誤率(%) '; <BR>for( var j = 0 ; j < listInfos[i].length ; j ){ <br>tableStr ='<tr>'; <br>tableStr ='<td><a href="detail.php ?type=programs&pid=1">' listInfos[i][j]['name'] ''; <BR>tableStr ='<td>' listInfos[i][j][ 'DayCount'] ''; <BR>tableStr ='<td>' listInfos[i][j]['AvgTime'] ''; <BR>tableStr ='<td>' listInfos[i][j]['ErrCount'] ''; <BR>tableStr ='<td>' listInfos[i][j]['ErrorRate'] ''; <BR>tableStr ='<td>' listInfos[i][j]['DaySystemErrorCount'] ''; <BR>tableStr ='<td>' listInfos[i][j]['DaySystemrErrorRate'] ' '; <BR>tableStr =''; <BR>} <BR>tableStr =''; <BR>tableStrList = tableStr <BR>} <BR><BR>document.getElementById("html").innerHTML=tableStrList; <BR>} <BR>sortOperation(listInfos,'DayCount','asc') <BR></script>