<select οnchange="filterschool()"></select>
<select οnchange="filterdirection()"></select>
<a οnclick="filterhot(1)">最新</a>
<a οnclick="filterhot(2)">最热</a>
<script type="text/javascript">
var schoolvalue = 0,
directionvalue = 0,
hotvalue = 0;
function filterschool(){
var obj = document.getElementById("filter-school");
var index = obj.selectedIndex;
schoolvalue = obj.options[index].value;
creaturl()
};
function filterdirection(){
var obj = document.getElementById("filter-direction");
var index = obj.selectedIndex;
directionvalue = obj.options[index].value;
creaturl()
}
function filterhot(hot){
hotvalue = hot;
creaturl()
}
function creaturl(){
url = schoolvalue+"/"+directionvalue+"/"+hotvalue;
console.log(url)
}
</script>
界面:
两个select标签,学校、方向。
两个a标签分别是最热、最新。
选择任意,生成一个url,实现筛选效果。