-/* vim: set ts=4 tw=4 sw=4 noet: */
+/* vim: set ts=4 tw=0 sw=4 noet: */
function updateRowsPerPage() {
var pos;
var url;
var base;
var href;
- var rowsPerPage = document.getElementById("rows");
var link = document.getElementsByTagName('a');
var found = false;
+ var rowsPerPage = document.getElementById("rows");
+
+ if (rowsPerPage.value == '') {
+ rowsPerPage.value = '20';
+ }
for (var i = 0; i < link.length; i++) {
url = link[i].href;
pos = url.search('rowsperpage');
}
}
if (found == false) {
- href = location.href + '?rowsperpage=' + rowsPerPage.value;
+ pos = location.href.search('rowsperpage');
+ if (pos >= 0) {
+ base = location.href.slice(0, pos);
+ } else {
+ base = location.href;
+ }
+ if (base.charAt(base.length - 1) == '?') {
+ href = base + 'rowsperpage=' + rowsPerPage.value;
+ } else {
+ href = base + '?rowsperpage=' + rowsPerPage.value;
+ }
} else {
pos = location.href.search('rowsperpage');
base = location.href.slice(0, pos);