/* vim: set ts=4 tw=4 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;
for (var i = 0; i < link.length; i++) {
- var url = link[i].href;
- var pos = url.search('rowsperpage');
+ url = link[i].href;
+ pos = url.search('rowsperpage');
if (pos >= 0) {
found = true;
- var base = url.slice(0, pos);
- var href = base + 'rowsperpage=' + rowsPerPage.value;
+ base = url.slice(0, pos);
+ href = base + 'rowsperpage=' + rowsPerPage.value;
link[i].href = href;
}
}
- var href = location.href + '?rowsperpage=' + rowsPerPage.value;
+ if (found == false) {
+ href = location.href + '?rowsperpage=' + rowsPerPage.value;
+ } else {
+ pos = location.href.search('rowsperpage');
+ base = location.href.slice(0, pos);
+ href = base + 'rowsperpage=' + rowsPerPage.value;
+ }
location.href = href;
}