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吧,可以试一下

    评论

报告相同问题?

悬赏问题

  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 LiBeAs的带隙等于0.997eV,计算阴离子的N和P
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 来真人,不要ai!matlab有关常微分方程的问题求解决,
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算