<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>
<body>
本程序演示多个条件查询或是分页时,对状态的保存。@auther www.phpchengdu.com <br />
本程序演示多个条件查询或是分页时,对状态的保存。@auther www.phpchengdu.com <br />
商品分类:
<a href="##" id="type-1" onclick="toURL(this)">全部</a>
<a href="##" id="type-2" onclick="toURL(this)">电视</a>
<a href="##" id="type-3" onclick="toURL(this)">计算机</a>
<a href="##" id="type-4" onclick="toURL(this)">洗衣机</a>
<br />
品牌:
<a href="##" id="brand-1" onclick="toURL(this)">全部</a>
<a href="##" id="brand-2" onclick="toURL(this)">索尼</a>
<a href="##" id="brand-3" onclick="toURL(this)">创维</a>
<a href="##" id="brand-4" onclick="toURL(this)">长虹</a>
<br />
尺寸:
<a href="##" id="size-1" onclick="toURL(this)">全部</a>
<a href="##" id="size-2" onclick="toURL(this)">32</a>
<a href="##" id="size-3" onclick="toURL(this)">37</a>
<a href="##" id="size-4" onclick="toURL(this)">42</a>
<br />
价格范围:
<a href="##" id="price-1" onclick="toURL(this)">全部</a>
<a href="##" id="price-2" onclick="toURL(this)">0~499</a>
<a href="##" id="price-3" onclick="toURL(this)">500~2000</a>
<a href="##" id="price-4" onclick="toURL(this)">2000以上</a>
<a href="##" id="type-1" onclick="toURL(this)">全部</a>
<a href="##" id="type-2" onclick="toURL(this)">电视</a>
<a href="##" id="type-3" onclick="toURL(this)">计算机</a>
<a href="##" id="type-4" onclick="toURL(this)">洗衣机</a>
<br />
品牌:
<a href="##" id="brand-1" onclick="toURL(this)">全部</a>
<a href="##" id="brand-2" onclick="toURL(this)">索尼</a>
<a href="##" id="brand-3" onclick="toURL(this)">创维</a>
<a href="##" id="brand-4" onclick="toURL(this)">长虹</a>
<br />
尺寸:
<a href="##" id="size-1" onclick="toURL(this)">全部</a>
<a href="##" id="size-2" onclick="toURL(this)">32</a>
<a href="##" id="size-3" onclick="toURL(this)">37</a>
<a href="##" id="size-4" onclick="toURL(this)">42</a>
<br />
价格范围:
<a href="##" id="price-1" onclick="toURL(this)">全部</a>
<a href="##" id="price-2" onclick="toURL(this)">0~499</a>
<a href="##" id="price-3" onclick="toURL(this)">500~2000</a>
<a href="##" id="price-4" onclick="toURL(this)">2000以上</a>
<br />
按尺寸排序:
<a href="##" id="order-size-asc" onclick="toURL(this)">升序</a>
<a href="##" id="order-size-desc" onclick="toURL(this)">降序</a>
<br />
<input type="hidden" name="parameter" id="parameter" value="type-3,brand-3,size-4,price-3,order-size-asc" />
where type='3' and brand='3' and size='4' and price='3' and <br />where type='3' and brand='3' and size='4' and price='3'<br />对应的sql语句为:select * from goods where type='3' and brand='3' and size='4' and price='3' order by size asc<script type="text/javascript">
function toURL(obj){
//alert(obj.id);
var currentParameterString=obj.id;
var oldParameterString=document.getElementById('parameter').value;
if(oldParameterString==''){
oldParameterArray=new Array();
//alert('null');
}else{
//oldParameterString="type-1,sise-37"
//oldParameterArray=Array("type-1","size-37")
var oldParameterArray=oldParameterString.split(',');//= php explod()
}
var inParameter=false;
for(var i=0;i<oldParameterArray.length;i++){
//判断大类是否存在
//size-3 Array('size','42');
var currentParameterArray=currentParameterString.split('-');
//oldParameterArray=Array("type-1","size-37")
//"type-1"
//tempArray=Array('type','1')
//tempArray=Array('size','37')
var tempArray=oldParameterArray[i].split('-');
if(currentParameterArray[0]==tempArray[0]){
//如果已有此类的过滤项存在,则用本次选中的过滤项替换旧的过滤项
// oldParameterArray[1]="size-42"
// oldParameterArray[1]="size-37"
oldParameterArray[i]=currentParameterString;
inParameter=true;
break;
}
}
//如果没有本类的过滤项存在,则插入新的过滤项
if(!inParameter){
oldParameterArray[i]=currentParameterString;
}
var newParameterString=oldParameterArray.join(',');
//alert(oldParameterArray.length);
alert(newParameterString);
document.location='list_filter.php?parameter='+newParameterString;
}
}
}
</script>
</body>
</html>
按尺寸排序:
<a href="##" id="order-size-asc" onclick="toURL(this)">升序</a>
<a href="##" id="order-size-desc" onclick="toURL(this)">降序</a>
<br />
<input type="hidden" name="parameter" id="parameter" value="type-3,brand-3,size-4,price-3,order-size-asc" />
where type='3' and brand='3' and size='4' and price='3' and <br />where type='3' and brand='3' and size='4' and price='3'<br />对应的sql语句为:select * from goods where type='3' and brand='3' and size='4' and price='3' order by size asc<script type="text/javascript">
function toURL(obj){
//alert(obj.id);
var currentParameterString=obj.id;
var oldParameterString=document.getElementById('parameter').value;
if(oldParameterString==''){
oldParameterArray=new Array();
//alert('null');
}else{
//oldParameterString="type-1,sise-37"
//oldParameterArray=Array("type-1","size-37")
var oldParameterArray=oldParameterString.split(',');//= php explod()
}
var inParameter=false;
for(var i=0;i<oldParameterArray.length;i++){
//判断大类是否存在
//size-3 Array('size','42');
var currentParameterArray=currentParameterString.split('-');
//oldParameterArray=Array("type-1","size-37")
//"type-1"
//tempArray=Array('type','1')
//tempArray=Array('size','37')
var tempArray=oldParameterArray[i].split('-');
if(currentParameterArray[0]==tempArray[0]){
//如果已有此类的过滤项存在,则用本次选中的过滤项替换旧的过滤项
// oldParameterArray[1]="size-42"
// oldParameterArray[1]="size-37"
oldParameterArray[i]=currentParameterString;
inParameter=true;
break;
}
}
//如果没有本类的过滤项存在,则插入新的过滤项
if(!inParameter){
oldParameterArray[i]=currentParameterString;
}
var newParameterString=oldParameterArray.join(',');
//alert(oldParameterArray.length);
alert(newParameterString);
document.location='list_filter.php?parameter='+newParameterString;
}
}
}
</script>
</body>
</html>


