php篩選功能 前后臺(tái)一起實(shí)現(xiàn) 后臺(tái)對(duì)接可以拼接sql語(yǔ)句,PHP列表頁(yè)中常見(jiàn)篩選功能,php通過(guò)表單值隱藏值篩選
表單篩選核心函數(shù)
function Filter(a, b) {
var $ = function(e) {
return document.getElementById(e);
}
var ipts = $('filterForm').getElementsByTagName('input'), result = [];
for (var i = 0, l = ipts.length; i < l; i++) {
if (ipts[i].getAttribute('to') == 'filter') {
result.push(ipts[i]);
}
}
if ($(a)) {
$(a).value = b;
for (var j = 0, len = result.length; j < len; j++) {
if (result[j].value == '' || result[j].value == '0') {
result[j].parentNode.removeChild(result[j]);
}
}
document.forms['filterForm'].submit();
}
return false;
}