下拉菜单更改URL重置页面

时间:2015-08-06 22:00:23

标签: javascript jquery html drop-down-menu

好的,我有一个表格,其中包含从JSON中提取的信息,我希望能够根据URL过滤表格中显示的内容。因此,我添加了一些代码,这些代码会在下拉菜单更改时更改URL(对于每个不同的过滤器)。它可以更改网址(它变为example.com?filter=memoriesexample.com?filter=booklet或选择哪个过滤器。唯一的事情不是跟进并进入它应该去的过滤器功能,而是只是重置页面而没有任何显示。控制台中没有错误,所以我不确定我是否只是遗漏了一些明显的或什么。以下是执行过滤并更改URL的代码:

function getUrlParameter(changeURL)
{
    window.document.location.href=changeURL; 
    var sPageURL = window.location.search.substring(1);
    var sURLVariables = sPageURL.split('&');
    for (var i = 0; i < sURLVariables.length; i++) 
    {
        var sParameterName = sURLVariables[i].split('=');
        if (sParameterName[0] == null) 
        {
            filterAll();
        }
        else{
            var theChoice = sParameterName[1];
            filterChoice(theChoice);
        }
    }
}   


function filterChoice(choice){
    if(choice.value=="all"){
        clearTable();
        filterAll();
    }
    else if (choice.value=="booklet"){
        bounds = "Booklet";
        clearTable();
        filterByTimerName(bounds);
    }
    else if(choice.value=="frontier"){
        bounds = "Frontier";
        clearTable();
        filterByTimerName(bounds);
    }
    else if(choice.value=="fs"){
        bounds = "FS";
        clearTable();
        filterByTimerName(bounds);
    }
    else if(choice.value == "ft"){
        bounds = "FT";
        clearTable();       
        filterByTimerName(bounds);
    }
    else if(choice.value == "home"){
        bounds = "Home";
        clearTable();       
        filterByTimerName(bounds);
    }
    else if(choice.value == "idx"){
        bounds = "IDX";
        clearTable();
        filterByTimerName(bounds);
    }
    else if(choice.value == "login"){
        bounds = "Login";
        clearTable();
        filterByTimerName(bounds);
    }
    else if(choice.value == "memories"){
        bounds = "Memories";
        clearTable();
        filterByTimerName(bounds);
    }
    else if(choice.value == "search"){
        bounds = "Search";
        clearTable();
        filterByTimerName(bounds);
    }
    else if(choice.value == "signInPage"){
        bounds = "SignInPage";
        clearTable();
        filterByTimerName(bounds);
    }
    else if(choice.value == "signOut"){
        bounds = "SignOut";
        clearTable();
        filterByTimerName(bounds);
    }
    else if(choice.value == "temple"){
        bounds = "Temple";
        clearTable();
        filterByTimerName(bounds);
    }
}

我真的很感激我能得到任何帮助!我添加了一些图片以供澄清。 What it is supposed to look like What it DOES look like 谢谢!!!

0 个答案:

没有答案