Kopieren Sie den Code -Code wie folgt:
<div id = "html"> </div>
<Script>
var listInfos = new Array ();
listInfos [0] = new Array ();
ListInfos [0] [0] = {'Name': 'Empfohlene Seite 1', 'DayCount': 666, 'AvgTime': 29872, 'Errcount': 180663, 'errorraate': '2873%', 'DaysystemStemrorrrorrrorrrorrorror Count' ' : 0.
ListInfos [0] [1] = {'Name': 'Empfohlene Seite 2', 'DayCount': 593896, 'AvgTime': 24946, 'Errcount': 222, 'Errorraate': '2%', 'DaysystemErrorcou nt' : 0.
ListInfos [0] [2] = {'Name': 'Empfohlene Seite 3', 'DayCount': 956, 'AvgTime': 27957, 'Errcount': 111, 'Errorraate': '10%',' Daysystemsemercount 'daneben 0.
listInfos [1] = new Array ();
ListInfos [1] [0] = {'Name': 'Empfohlene Seite 4', 'DayCount': 666, 'AvgTime': 116, 'Errcount': 180663, 'errorraate': '2873%', 'DaysystemErrorcou nt' : 0.
ListInfos [1] [1] = {'Name': 'Empfohlene Seite 5', 'DayCount': 11, 'AvgTime': 222, 'Errcount': 222, 'errorrate': '2%', 'DaysystemErrorCount': 0.
ListInfos [1] [2] = {'Name': 'Empfohlene Seite 6', 'DayCount': 956, 'AvgTime': 956, 'Errcount': 111, 'Errorrate': '10%',' DaysystemerrorCount ': 0.
Funktion datedesc (listInfos, field) {{{{{{{
für (var i = 0; i <chistinfos.length; i ++) {
für (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;
}
}
}
Rückgabelisteninfos;
}
FunktionsdataAsc (ListInfos, Feld) {
für (var i = 0; i <chistinfos.length; i ++) {
für (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;
}
}
}
Rückgabelisteninfos;
}
Funktion isCommapercent (Wert) {
var valueFloat;
value = value.tolocalestring ();
valueFloat = (value.indexof (',')> 0)?
ValueFloat = (valueFloat.indexof ('%')> 0)?
Return ValueFloat;
}
Funktionssortoperation (SortInfos, Feld, sortieren) {{{{{{{{{{{{{{{{{{{{{{{
var listInfos = new Array ();
if (sort == 'Desc') {{{{{
für (var i = 0; i <sortinfos.length; i ++) {
ListInfos [i] = datiNfos [i], field);
}
} else if (sort == 'asc') {
für (var i = 0; i <sortinfos.length; i ++) {
ListInfos [i] = dataSc (SortInfos [i], Feld);
}
} Anders {
alert ('Betriebsfehler ...');
False zurückgeben;
}
var tischestrist = '';
für (var i = 0; i <chistinfos.length; i ++) {
var tab TableStr = '<h1> Programm </h1>';
tabafestr+= '<table cellspacing = "0" cellpadding = "0"> <tbody> <ter>';
Tab TableSt += '<Td> Programmname </td> <td> Besuche des Tages (Zeiten) </td> <td> Durchschnittliche Antwortzeit (US) </td> <td> Fehlernummer (Zeiten) </</ td> ';
Tabelle += '<Td> Fehlerrate (%) </td> <td> Systemfehler (Zeiten) </td> <td> Systemfehlerrate (%) </td> </tr>';
für (var j = 0; j <listInfos [i] .Length; j ++) {
tab TableSt += '<ter>';
tabafestr+= '<td> <a href = "detail.php? type = programme & pid = 1">'+listInfos [i] [j] ['name']+'</a> </td>';
tababest+= '<td>'+listInfos [i] [j] ['DayCount']+'</td>';
tababest+= '<td>'+listInfos [i] [j] ['AvgTime']+'</td>';
tababest+= '<td>'+listInfos [i] [j] ['errcount']+'</td>';
tababest+= '<td>'+listInfos [i] [j] ['errorraate']+'</td>';
tababest+= '<td>'+listInfos [i] [j] ['DaysystemerCerCount']+'</td>';
tabsätze+= '<td>'+listInfos [i] [j] ['Daysystemrrrrate']+'</td>';
tab TableSt += '</tr>';
}
tababest += '</tbody> </table>';
tischestrist += tischtisch
}
document.getElementById ("html").
}
sortoperation (listInfos, 'taycount', 'asc')
</script>