Copier le code du code comme suit:
<div id = "html"> </div>
<cript>
var listInfos = new Array ();
listinfos [0] = new Array ();
listinfos [0] [0] = {'name': 'recommandée Page 1', 'DayCount': 666, 'Avgtime': 29872, 'ErrCount': 180663, 'Errorraate': '2873%', 'DaysystemerRorRorRrorRorRorRorror Count' : 0.
listinfos [0] [1] = {'name': 'recommandé page 2', 'dayCount': 593896, 'avgtime': 24946, 'errCount': 222, 'errorraate': '2%', 'DaysystemErrorCou nt' : 0.
listinfos [0] [2] = {'name': 'recommandée page 3', 'dayCount': 956, 'avgtime': 27957, 'errCount': 111, 'errorraate': '10% ',' DaystemSemerCount ' 0.
listinfos [1] = new Array ();
listinfos [1] [0] = {'name': 'recommandée page 4', 'dayCount': 666, 'avgtime': 116, 'errCount': 180663, 'errorraate': '2873%', 'DaysystemErrorCou nt' : 0.
listinfos [1] [1] = {'name': 'recommandé page 5', 'dayCount': 11, 'avgtime': 222, 'errCount': 222, 'errorrate': '2%', 'DaysystemErrorCount': 0.
listinfos [1] [2] = {'name': 'recommandée page 6', 'dayCount': 956, 'avgtime': 956, 'errCount': 111, 'errorrate': '10% ',' DaysystemErrOnCount ': 0.
Fonction DaDaSc (listinfos, champ) {{{
pour (var i = 0; i <listinfos.length; i ++) {
pour (var j = i + 1; j <listinfos.length; j ++) {
if (isComMAmpercent (listinfos [i] [field]) <isComMAmpercent (listinfos [j] [champ])) {) {
var arrayTemp = new Array ();
arrayTemp = listinfos [i];
listinfos [i] = listinfos [j];
listinfos [j] = arrayTemp;
}
}
}
Retourner listinfos;
}
Fonction dataasc (listinfos, champ) {
pour (var i = 0; i <listinfos.length; i ++) {
pour (var j = i + 1; j <listinfos.length; j ++) {
if (isComMAmpercent (listinfos [i] [champ])> isComMAmpercent (listinfos [j] [champ])) {) {
var arrayTemp = new Array ();
arrayTemp = listinfos [i];
listinfos [i] = listinfos [j];
listinfos [j] = arrayTemp;
}
}
}
Retourner listinfos;
}
Fonction isComMAmpercent (valeur) {
var valeurfloat;
valeur = valeur.tolocalestring ();
ValueFloat = (Value.Indexof (',')> 0)?
ValueFloat = (ValueFloat.Indexof ('%')> 0)?
Return ValueFloat;
}
Fonction sortOperation (trinfos, champ, tri) {{
var listInfos = new Array ();
if (tri == 'desc') {{
pour (var i = 0; i <trinfos.length; i ++) {
listinfos [i] = DADACS (triNFOS [i], champ);
}
} else if (tri == 'asc') {
pour (var i = 0; i <trinfos.length; i ++) {
listInfos [i] = dataasc (trinfos [i], champ);
}
} Autre {
alert ('Opération Erreur ...');
Retourne false;
}
var Tablestrist = '';
pour (var i = 0; i <listinfos.length; i ++) {
var tablestr = '<h1> programme </h1>';
tablestr + = '<Table CellSpacing = "0" CellPadding = "0"> <tbody> <Ter>';
Tablestr + = '<Td> Nom du programme </td> <TD> Visites du jour (fois) </td> <td> Temps de réponse moyen (US) </td> <td> Numéro d'erreur (fois) </ td> ';
Tablestr + = '<Td> Taux d'erreur (%) </td> <td> Erreur du système (fois) </td> <td> Taux d'erreur du système (%) </td> </tr>';
pour (var j = 0; j <listinfos [i] .length; j ++) {
tablestr + = '<Ter>';
tablestr + = '<td> <a href = "de détail.php? type = programmes & pid = 1">' + listinfos [i] [j] ['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] ['errorraate'] + '</td>';
tablestr + = '<td>' + listinfos [i] [j] ['DaysystemErreccount'] + '</td>';
tablestr + = '<td>' + listinfos [i] [j] ['daysystemerrrrate'] + '</td>';
tablestr + = '</tr>';
}
tablestr + = '</tbody> </s table>';
Tablestriste + = tablette
}
document.getElementById ("html").
}
SORTOPERATION (LISTINFOS, 'DAYCOUNT', 'ASC')
</cript>