日期:2014-05-16  浏览次数:20443 次

javascript的jsp页面跳转问题
$("#submit_add").click(function() {
    var test="";
    var operation="ADD";
    $("input[name=checkbox_add]").each(function() {
        if ($(this).attr("checked")) {
            test += "," + $(this).val();
        }
    });
    keywords=test.split(",");
    if(keywords.length>1)
        {

                            topic_display(test,operation);
                        } else
                            alert("请先选择关键词!");
                    });
主要功能是添加关键词,现在想要将“alert("请先选择关键词!");”这句改为else跳转到另一个“manage_keyword.jsp”页面。我试了j将alert那句直接换成window.location.href="manage_keyword.jsp?backurl="+window.location.href; 或者window.location.href="manage_keyword.jsp“;以及response.sendRedirect"(/manage_keyword.jsp");好像都不能实现,请教大神,我该怎么改写???


                            
------解决方案--------------------
你在js里面肯定不能写response..了,一般就这样应该能实现:
location.href="xxx.jsp";
注意一下路径什么的,firebug下调试一下看看报什么错。