关闭小广告
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
*{
margin: 0;
padding: 0;
}
div{
width: 230px;
height: 200px;
position: relative;
}
#c{
width: 20px;
cursor: pointer;
position: absolute;
top: 0;
left: 0;
}
#img10{
position: absolute;
top: 0px;
left: 20px;
}
</style>
</head>
<body>
<div id="box">
<img src="images/c.jpg" id="c">
<img src="images/10.png" id="img10">
</div>
<script>
var c=document.getElementById("c");
var div=document.getElementById("box");
c.onclick=function(){
box.style.display="none";
}
</script>
</body>
</html>
换肤
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
*{
margin: 0;
padding: 0;
}
body{
background-image:url("images/09_1.jpg") ;
transition: all 1s;
}
div#box{
width: 100%;
height: 140px;
background-color: rgba(49, 48, 48, 0.3);
padding: 20px 0px;
}
#bao{
width: 920px;
margin: 0 auto;
}
img{
width: 200px;
margin-left: 20px;
transition: all 1s;
}
</style>
</head>
<body>
<div id="box">
<div id="bao">
<img src="images/09_1.jpg" class="li">
<img src="images/09_2.jpg">
<img src="images/09_3.jpg">
<img src="images/09_4.jpg">
</div>
</div>
<script>
var img=document.querySelectorAll("img");
var body=document.querySelector("body");
for(var i=0;i<img.length;i++){
img[i].onclick=function(){
body.style.backgroundImage=`url(${this.src})`;
f1();
this.style.cssText="transform: scale(1.1);border-radius: 10px;";
}
}
function f1(){
for(var i=0;i<img.length;i++){
img[i].style="none";
}
}
</script>
</body>
</html>