Use js to make a select all delete page

                                              Use js to make a select all delete page
First create a table with the table tag in the body

<script type="text/javascript">
     function checkall(chk){
     var ischeck=chk.checked;
     var list=document.getElementsByName('chkstu');
     for(var i=0;i<list.length;i++){
       var mychk=list[i];
       mychk.checked=ischeck;
       }
     }

</script>
Apply Select All

Delete as a link Set a link tag in td <td><a href="#">del</a></td>
and then use window in script to get all delete a links on the page


<script type="text/javascript">
  window.onload=function(){
    var linklist=document.getElementsByTagName('a');
    for(var i=0;i<linklist.length;i++){
      var mylink=linklist [i];
      mylink.onclick=function(){
        var delnode=this.parentNode.parentNode;
        var pnode=delnode.parentNode;
        pnode.removeChild(delnode);
      }
    }
   When the mouse moves to the position in the table, it will change color when it is moved away The original color for the table    
       var trs=document.getElementsByTagName('tr');
       for(var i=1;i<trs.length;i++){
         var mytr=trs[i];
         var oldcolor;
         mytr.onmouseover=function( ){
           oldcolor=this.style.background;
          this.style.background="#ccc";
           }
            mytr.onmouseout=function(){
          this.style.background=oldcolor;
         }
         }
       }
</script>

The final effect is as follows:

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324781209&siteId=291194637