zoukankan      html  css  js  c++  java
  • input check复选框选择后修改<a>标签超链接href

    1. 给复选框添加onclick事件 获取标签id

     1     <tbody>
     2                         <c:forEach var="file" items="${files}">
     3                         <tr class="er" onMouseMove="changeTrColor(this)">
     4                             <td class="xuanze"><input type="checkbox" name="r" value="${file.id}" onclick="aa()"/></td>
     5                             <td class="name">${file.filename}</td>
     6                             <td class="daxiao">15k</td>
     7                             <td class="time"><a href="#">2015-01-01</a> <select><option>删除</option><option>移动到</option><option>复制到</option><option>下载</option></select></td>
     8                         </tr>
     9                       </c:forEach>
    10                     </tbody>

    2。给a标签添加id

    1   <div class="btn2">
    2             <a href="#" id="xiazai">下载</a>
    3             <a href="#">删除</a>
    4             <a href="#">打印</a>
    5         </div>

    3.获取复选框id修改href属性

     1 function aa(){
     2     alert("aa");
     3     var r=document.getElementsByName("r"); 
     4     for(var i=0;i<r.length;i++){
     5          if(r[i].checked){
     6          alert(r[i].value);
     7          var num = r[i].value;
     8          document.getElementById("xiazai").href="file/download?id="+num;
     9        }
    10     }     
    11 }
  • 相关阅读:
    Day3学习笔记
    Day2学习笔记
    Day1学习笔记
    中文标识
    about original idea
    那些和matlab有关的
    GRE Sub math 报名
    虽然实际没有什么用,但是可能会有理论上的意义吧
    latex相关
    对venturelli theorem的重新认识
  • 原文地址:https://www.cnblogs.com/sharpest/p/5990454.html
Copyright © 2011-2022 走看看