level 2
a1372595462
楼主
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
*{
padding: 0;
margin: 0;
}
div{
height:279px;
width:100px;
background:url(./img/deng.jpg);
}
</style>
</head>
<body>
</body>
</html>
<script>
function Deng(){
this.singal = 0;
this.dom = null;
this.init();
this.bindEvent();
}
Deng.prototype.init = function(){
this.dom = document.createElement("div");
document.body.appendChild(this.dom);
}
Deng.prototype.bindEvent = function(argument){
var self = this;
this.dom.onclick = function(argument){
self.singal++;
self.singal = self.singal>2?0:self.singal;
this.style.backgroundPosition = self.singal*100+"px 0px";
}
}
new Deng();
Deng();
</script>
2018年08月11日 08点08分
1
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
*{
padding: 0;
margin: 0;
}
div{
height:279px;
width:100px;
background:url(./img/deng.jpg);
}
</style>
</head>
<body>
</body>
</html>
<script>
function Deng(){
this.singal = 0;
this.dom = null;
this.init();
this.bindEvent();
}
Deng.prototype.init = function(){
this.dom = document.createElement("div");
document.body.appendChild(this.dom);
}
Deng.prototype.bindEvent = function(argument){
var self = this;
this.dom.onclick = function(argument){
self.singal++;
self.singal = self.singal>2?0:self.singal;
this.style.backgroundPosition = self.singal*100+"px 0px";
}
}
new Deng();
Deng();
</script>