次のようにコードコードをコピーします。
<div id = "html"> </div>
<スクリプト>
var listinfos = new array();
listinfos [0] = new array();
listInfos [0] [0] = {'name': '推奨ページ1'、 'daycount':666、 'avgtime':29872、 'errcount':180663、 'errorraate': '2873%'、 'daystystemerrorrerrerrerrerrerrerror count' ' :0。
listinfos [0] [1] = {'name': '推奨ページ2'、 'daycount':593896、 'avgtime':24946、 'errcount':222、 'errorraate': '2%'、 'daysystemerrorcou nt' ' :0。
listinfos [0] [2] = {'name': '推奨ページ3'、 'daycount':956、 'avgtime':27957、 'errcount':111、 'errorraate':'10% '、' daysystememercount ' 0。
listinfos [1] = new array();
listinfos [1] [0] = {'name': '推奨ページ4'、 'daycount':666、 'avgtime':116、 'errcount':180663、 'errorraate': '2873%'、 'daysystemerrorcou nt' ' :0。
listinfos [1] [1] = {'name': '推奨ページ5'、 'daycount':11、 'avgtime':222、 'errcount':222、 'errorrate': '2%'、 'daysystemerrorcount': 0。
listinfos [1] [2] = {'name': '推奨ページ6'、 'daycount':956、 'avgtime':956、 'errcount':111、 'errorrate':'10% '、' daysystemerrorcount ': 0。
function datedesc(listinfos、field){{
for(var i = 0; i <chistinfos.length; i ++){
for(var j = i+1; j <listinfos.length; j ++){
if(iscommapercent(listinfos [i] [field])<iscommapercent(listinfos [j] [field])){){
var arraytemp = new Array();
arraytemp = listinfos [i];
listinfos [i] = listinfos [j];
listinfos [j] = arraytemp;
}
}
}
Return ListInfos;
}
function dataasc(listinfos、field){
for(var i = 0; i <chistinfos.length; i ++){
for(var j = i+1; j <listinfos.length; j ++){
if(iscommapercent(listinfos [i] [field])> iscommapercent(listinfos [j] [field])){){
var arraytemp = new Array();
arraytemp = listinfos [i];
listinfos [i] = listinfos [j];
listinfos [j] = arraytemp;
}
}
}
Return ListInfos;
}
関数iscommapercent(value){
var valuefloat;
value = value.tolocalestring();
valueFloat =(value.indexof( '、')> 0)?
valueFloat =(valueFloat.indexof( '%')> 0)?
valuefloatを返します。
}
関数SORTOPERATION(SORTINFOS、FIELD、SORT){{
var listinfos = new array();
if(sort == 'desc'){{
for(var i = 0; i <sortinfos.length; i ++){
listinfos [i] = datedesc(sortinfos [i]、field);
}
} else if(sort == 'asc'){
for(var i = 0; i <sortinfos.length; i ++){
listinfos [i] = dataasc(sortinfos [i]、field);
}
} それ以外 {
アラート( '操作エラー...');
falseを返します。
}
var tableStrist = '';
for(var i = 0; i <chistinfos.length; i ++){
var tableestr = '<h1>プログラム</h1>';
TableStr+= '<Table CellSpacing = "0" cellPadding = "0"> <tbody> <ter>';
TableStr += '<TD>プログラム名</td> <td>その日の訪問(時間)</td> <td>平均応答時間(US)</td> <td>エラー番号(時間)</ td> ';
TableStr += '<TD>エラー率(%)</td> <td>システムエラー(時間)</td> <td>システムエラー率(%)</td> </tr>';
for(var j = 0; j <listinfos [i] .length; j ++){
TableStr += '<Ter>';
TableStr+= '<td> <a href = "detail.php?type = pid = 1">'+listinfos [i] ['name']+'</a> </td>';
TableStr+= '<td>'+listinfos [i] [j] ['daycount']+'</td>';
TableStr+= '<td>'+listinfos [i] [j] ['avgtime']+'</td>';
TableStr+= '<td>'+listinfos [i] [j] ['errcount']+'</td>';
TableStr+= '<TD>'+listInfos [i] [j] ['errorrate']+'</td>';
TableStr+= '<td>'+listinfos [i] [j] ['daysystemerrercount']+'</td>';
TableStr+= '<td>'+listinfos [i] [j] ['daysystemerrrrate']+'</td>';
TableStr += '</tr>';
}
TableStr += '</tbody> </table>';
TabreStrist += TableStr
}
document.getElementByID( "HTML")。
}
sortoperation(listinfos、 'daycount'、 'asc')
</script>