87,910
社区成员
发帖
与我相关
我的任务
分享
<html>
<head>
<title></title>
</head>
<script>
function $(id){
return document.getElementById(id);
}
var Class = {
create: function() {
return function() {
this.initialize.apply(this, arguments);
}
}
}
var Box = Class.create();
Box.prototype = {
initialize : function (members){
var _self = this;
this._members = members;
setInterval(_self.play,1000);
},
play : function (){
alert(this._members[0].id);
}
};
</script>
<body>
<div id="c1"></div>
<div id="c2"></div>
<div id="c3"></div>
</body>
<script>
new Box([$("c1"),$("c2"),$("c3")]);
</script>
</html>
...
function (){
alert(this._members[0].id);
}
...