我在页面上有一个部分,其中包含基于下拉列表选择的过滤器。 选择命令是:
<select id="dropdown">
<option class="filter" value="all" selected>All types</option>
<option class="filter" value="type1">Type 1</option>
<option class="filter" value="type2">Type 2</option>
<option class="filter" value="type3">Type 3</option>
</select>
我想链接到此页面的过滤类型,例如标题为“类型1”的链接将指向带有过滤器值“type1”的“page.html”,标题为“类型2”的链接将指向“ page.html“但有过滤值”type2“等。 我相信不可能在这个链接上使用href,还有其他方法吗?
答案 0 :(得分:0)
我不确定你对过滤器的意思,但如果你的意思是GET参数,你可以使用JavaScript:
document.getElementById('dropdown').onchange = function() {
window.location.href = 'page.html?filter='+this.value;
};