]>
Commit | Line | Data |
---|---|---|
1 | /* vim: set ts=4 tw=0 sw=4 noet: */ | |
2 | ||
3 | function updateRowsPerPage() { | |
4 | var pos; | |
5 | var url; | |
6 | var base; | |
7 | var href; | |
8 | var link = document.getElementsByTagName('a'); | |
9 | var found = false; | |
10 | var rowsPerPage = document.getElementById("rows"); | |
11 | ||
12 | if (rowsPerPage.value == '') { | |
13 | rowsPerPage.value = '20'; | |
14 | } | |
15 | for (var i = 0; i < link.length; i++) { | |
16 | url = link[i].href; | |
17 | pos = url.search('rowsperpage'); | |
18 | if (pos >= 0) { | |
19 | found = true; | |
20 | base = url.slice(0, pos); | |
21 | href = base + 'rowsperpage=' + rowsPerPage.value; | |
22 | link[i].href = href; | |
23 | } | |
24 | } | |
25 | if (found == false) { | |
26 | pos = location.href.search('rowsperpage'); | |
27 | if (pos >= 0) { | |
28 | base = location.href.slice(0, pos); | |
29 | } else { | |
30 | base = location.href; | |
31 | } | |
32 | if (base.charAt(base.length - 1) == '?') { | |
33 | href = base + 'rowsperpage=' + rowsPerPage.value; | |
34 | } else { | |
35 | href = base + '?rowsperpage=' + rowsPerPage.value; | |
36 | } | |
37 | } else { | |
38 | pos = location.href.search('rowsperpage'); | |
39 | base = location.href.slice(0, pos); | |
40 | href = base + 'rowsperpage=' + rowsPerPage.value; | |
41 | } | |
42 | location.href = href; | |
43 | } |