X-Git-Url: http://git.datanom.net/qtadmin.git/blobdiff_plain/24560f82492efc949a52306199478e43d7b70e31..b4a9e00ed371c95536e74e700df60d6590413c45:/js/forms.js?ds=inline diff --git a/js/forms.js b/js/forms.js index ff0f33d..9836e96 100644 --- a/js/forms.js +++ b/js/forms.js @@ -1,12 +1,29 @@ /* 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; - if ((var pos = url.search('rowsperpage')) >= 0) { - var base = url.slice(0, pos); - alert('base: ' + base); + url = link[i].href; + pos = url.search('rowsperpage'); + if (pos >= 0) { + found = true; + base = url.slice(0, pos); + href = base + 'rowsperpage=' + rowsPerPage.value; + link[i].href = href; } } + 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; }