第一次月考总结


T1:

.content .img1{
margin-left: 0;          图片左边距为0  最左边
}

.content .img2{
margin-right: 0;      图片右边距为0  最右边
}

.content img{
width: 131.6px;
height: 131.6px;
margin-top: 18px;     图片距离最上边18px
margin-left: 16px;     图片之间的间距为16px
}

T2

当鼠标移入页面小图时,在鼠标右侧展示对应大图

window.onload=function(){
var imgs=document.querySelectorAll("img");
var big=document.querySelector(".big");
for(let i=0;i
imgs[i].onmousemove=function(e){       鼠标移入事件    e为传值
big.style.top=e.y+10+"px";                     鼠标移入的坐标
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";
}
}
}

T3:

全选
$(function(){
$("#chkAll").change(function(){
var checkbox=$(this).prop("checked")
$(":checkbox").prop("checked",checkbox)
console.log(checkbox)
})
})

删除当前行
$(function(){
$("button").click(function(){
var id=this.attributes["data-del"].value;
confirm("您确定要删除编号为 "+id+" 的商品?");
})
})

数据行复选框
$(function(){
$(":checkbox").change(function(){
var i= 0
var y= 0
$(":checkbox:not([id])").each(function(index,item){
var ck =$(item).prop("checked");
if(ck){

i++;
y += parseInt($(item).closest("tr").children().eq(3).text())

}

})

$(".money").text(y);
$(".count").text(i);
})
})