日期:2014-05-16 浏览次数:20441 次
function Butimgbar(imagepre,butpre,speed)
{
this._imagepre = imagepre;
this._butpre = butpre;
this._speed = speed;
this._isrun = false;
this._lastid = 0;
this._usedimg = this._imagepre + " li:eq(";
this._setevent = function(id){
$("#Slide li").mouseover(function(){
$(this._usedimg + id + ")").fadeIn(this._speed);
$(this._usedimg + this._lastid + ")").fadeOut(this._speed);
this._lastid = id;
});
}
}
function Butimgbar(imagepre,butpre,speed)
{
var self =this; //保存对象
this._imagepre = imagepre;
this._butpre = butpre;
this._speed = speed;
this._isrun = false;
this._lastid = 0;
this._usedimg = this._imagepre + " li:eq(";
this._setevent = function(id){
$("#Slide li").mouseover(function(){
$(this._usedimg + id + ")").fadeIn(this._speed);
$(this._usedimg + this._lastid + ")").fadeOut(this._speed);
this._lastid = id;
console.log(self);//这里用这个
});
}
}
function Butimgbar(imagepre,butpre,speed)
{
this._imagepre = imagepre;
this._butpre = butpre;
this._speed = speed;
this._isrun = false;
this._lastid = 0;
this._usedimg = this._imagepre + " li:eq(";
//声明一个_this变量,用来保存this
var _this = this;
this._setevent = function(id){
$("#Slide li").mouseover(function(){
$(_this._usedimg + id + ")").fadeIn(_this._speed);
$(_this._usedimg + _this._lastid + ")").fadeOut(_this._speed);
_this._lastid = id;
});
}
}