cuojing0496 2017-05-26 11:36 采纳率: 0%
浏览 1833

请问各位大神为什么jsp中按钮点击不跳转??

 <html>
  <head>
    <base href="<%=basePath%>">

    <title>My JSP 'modifysub.jsp' starting page</title>

  </head>
   <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet"/></link>
    <script src="bootstrap/js/jquery.min.js" type="text/javascript"></script>
    <script src="bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
    <script>
    $().ready(function(){
    $("#buxuan").click(function(){
    alert(65);
    var subid =$("#subget").val();
    location.href="showClass?type=modifysub&subid="+subid+"&classid="+classid+"";


    });


    });  

    </script>
  <body>
  <%int classid=(Integer)request.getAttribute("classid");
  %>
   <div style="width:650px;margin:20px auto;">
   <form >
   当前班级:<span style="color:#666;font-size:24px;"><%=request.getAttribute("classname") %></span>
   <hr style="color:#666;">
   <div style="width:200px;height:250px;float:left;">
   <select multiple class="form-control" scrolling="no" id="subget" style="width:200px;height:250px;" >
   <%List<Subject> list=(List<Subject>)request.getAttribute("sublist");
   for(int i=0;i<list.size();i++){
   %>
      <option style="font-size:20px;" value="<%=list.get(i).getSubid()%>"><%=list.get(i).getSubjectname() %></option>


      <%} %>
    </select>


   </div>
   <input type="button" id="buxuan" value=">>>" style="float:left;margin-top:70px;margin-left:50px;" />
   <input type="button" id="xuan" value="<<<" style="float:left;margin-top:150px;margin-left:-40px;" />
   <div style="width:200px;height:250px;border:1px black solid;margin-left:350px;">
   <select multiple class="form-control" scrolling="no" name="subnoget" style="width:200px;height:250px;" >
    <%List<Subject> nochoice=(List<Subject>)request.getAttribute("nochoice");
   for(int i=0;i<nochoice.size();i++){
   %>
      <option style="font-size:20px;" value="<%=nochoice.get(i).getSubid()%>"><%=nochoice.get(i).getSubjectname() %></option>
      <%} %>
    </select>

   </div>

   </form>
   </div>
  </body>
</html>

代码就是这样 点击那个叫sendno的按钮可以获得alert弹框,就说明进了点击事件,但是就是不跳转页面,地址栏也没有变化,是什么原因???先谢谢各位大神。。

  • 写回答

2条回答

  • 萧逸才 2017-05-27 02:25
    关注

    应该是window.location.href吧,可以试一下

    评论

报告相同问题?

悬赏问题

  • ¥50 易语言把MYSQL数据库中的数据添加至组合框
  • ¥20 求数据集和代码#有偿答复
  • ¥15 关于下拉菜单选项关联的问题
  • ¥20 java-OJ-健康体检
  • ¥15 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
  • ¥15 使用phpstudy在云服务器上搭建个人网站
  • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
  • ¥15 vue3+express部署到nginx
  • ¥20 搭建pt1000三线制高精度测温电路
  • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况