summaryrefslogtreecommitdiff
path: root/tests/make_png/script.js
diff options
context:
space:
mode:
Diffstat (limited to 'tests/make_png/script.js')
-rw-r--r--tests/make_png/script.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/make_png/script.js b/tests/make_png/script.js
new file mode 100644
index 000000000..0198cf9ea
--- /dev/null
+++ b/tests/make_png/script.js
@@ -0,0 +1,22 @@
+var people, asc1 = 1,asc2 = 1,asc3 = 1;
+
+function sort_t(tbody, col, asc){
+ var rows = tbody.rows, rlen = rows.length, arr = new Array(), i, j, cells, clen;
+ // fill the array with values from the table
+ for(i = 0; i < rlen; i++){
+ cells = rows[i].cells;
+ clen = cells.length;
+ arr[i] = new Array();
+ for(j = 0; j < clen; j++){
+ arr[i][j] = cells[j].innerHTML;
+ }
+ }
+ // sort the array by the specified column number (col) and order (asc)
+ arr.sort(function(a, b){
+ return (a[col] == b[col]) ? 0 : ((a[col] > b[col]) ? asc : -1*asc);
+ });
+ for(i = 0; i < rlen; i++){
+ arr[i] = "<td>"+arr[i].join("</td><td>")+"</td>";
+ }
+ tbody.innerHTML = "<tr>"+arr.join("</tr><tr>")+"</tr>";
+} \ No newline at end of file