考试总结

justify-content: space-between;/* 均匀排列每个元素首个元素放置于起点,末尾元素放置于终点 */

 

放大镜

 window.onload=function(){
        var imgs=document.querySelectorAll(".small"); //获取小图
        var big=document.querySelector(".big"); //获取大图
        for (let i = 0; i < imgs.length; i++) { //循环小图
            imgs [i].onmousemove = function(e){ //鼠标在小图上移动
            big.style.top=e.y+10+"px";  //big图距离顶部的位置是鼠标当前位置的y轴位置 e.y+10+"px"  +10是让鼠标与图片产生10px距离
            big.style.left=e.x+10+"px";
            big.src=this.src;
            }
            imgs [i].onmouseout=function(){ //鼠标移出
             big.style.display="none";
            }
            imgs [i].onmouseenter=function(){  //鼠标进入
             big.style.display="block";
            }
        }
        }
 
 
 
//全选/全不选
            $("#chkAll").change(function(){ //获取点击按钮的id
           var chk1=$(this).prop("checked") //获取当前checked属性
           $(":checkbox").prop("checked",chk1) //将所有的checkbox的checked改为当前获取的checked值是true或 false
           })

           //删除
           $("button").click(function() { //获取按钮
               var l=$(this).attr("data-del"); //data-del获取他的内容
               confirm("您确定要删除编号为"+l+"的商品?")//弹窗
               $("table tr:eq(1)").remove();//删除table中当前tr一行
            })

            //数据行复选框  
            $("input").change(function(){ //当input框发生改变
           var c=$(this).prop("checked")  //获取当前checked属性
           var te=$(".count").text() //count的值
           
           if(c){ //有checked属性 值+1 没有减1
             var n=parseInt(te)+1;
             $(".count").text(n);
           }else{
             var n=parseInt(te)-1;
             $(".count").text(n);
           }
posted @ 2021-11-21 12:47  熊熊日记  阅读(39)  评论(0)    收藏  举报