javascript,类的方式里面的setTimeout
functionTip(){this.iX=1;this.iY=2;this.oTip=document.getElementById("divTip1");this.t...
function Tip(){
this.iX=1;
this.iY=2;
this.oTip = document.getElementById("divTip1");
this.tipState;
this.iSetShow
}
Tip.prototype.showTip = function(oEvent){
if(!oEvent) window.event;
this.iX = oEvent.clientX;
this.iY = oEvent.clientY;
this.iSetShow = setTimeout(function(){
alert(caller);
this.tipState = "visible"
this.oTip.style.visibility = this.tipState;
this.oTip.style.left = oEvent.clientX + 5;
this.oTip.style.top = oEvent.clientY + 5;
},500);
}
Tip.prototype.hideTip = function(oEvent){
this.iSetShow = null;
this.tipState = "hidden";
this.oTip.style.visibility = this.tipState;
}
oTip1 = new Tip();
<div id="div1"
style="background-color: red; height: 50px; width: 50px"
onmouseover="oTip1.showTip(event)" onMouseOut="oTip1.hideTip(event)"></div>
<div id="divTip1"
style="background-color: yellow; position: absolute; visibility: hidden; padding: 5px">
<span style="font-weight: bold">Custom Tooltip</span><br />
More details can go here.
</div>
在这一段
this.iSetShow = setTimeout(function(){
this.tipState = "visible"
this.oTip.style.visibility = this.tipState;
this.oTip.style.left = oEvent.clientX + 5;
this.oTip.style.top = oEvent.clientY + 5;
},500);
里面的this和外面的this指向不同的对象,要怎么办啊? 展开
this.iX=1;
this.iY=2;
this.oTip = document.getElementById("divTip1");
this.tipState;
this.iSetShow
}
Tip.prototype.showTip = function(oEvent){
if(!oEvent) window.event;
this.iX = oEvent.clientX;
this.iY = oEvent.clientY;
this.iSetShow = setTimeout(function(){
alert(caller);
this.tipState = "visible"
this.oTip.style.visibility = this.tipState;
this.oTip.style.left = oEvent.clientX + 5;
this.oTip.style.top = oEvent.clientY + 5;
},500);
}
Tip.prototype.hideTip = function(oEvent){
this.iSetShow = null;
this.tipState = "hidden";
this.oTip.style.visibility = this.tipState;
}
oTip1 = new Tip();
<div id="div1"
style="background-color: red; height: 50px; width: 50px"
onmouseover="oTip1.showTip(event)" onMouseOut="oTip1.hideTip(event)"></div>
<div id="divTip1"
style="background-color: yellow; position: absolute; visibility: hidden; padding: 5px">
<span style="font-weight: bold">Custom Tooltip</span><br />
More details can go here.
</div>
在这一段
this.iSetShow = setTimeout(function(){
this.tipState = "visible"
this.oTip.style.visibility = this.tipState;
this.oTip.style.left = oEvent.clientX + 5;
this.oTip.style.top = oEvent.clientY + 5;
},500);
里面的this和外面的this指向不同的对象,要怎么办啊? 展开
1个回答
TableDI
2024-07-18 广告
2024-07-18 广告
VLOOKUP是Excel中用于垂直查找的函数,其基本用法包括四个参数:1. 查找值:即在数据表首列中需要搜索的值。2. 数据表:包含查找值的单元格区域或数组。3. 返回值所在列数:指定返回查询区域中第几列的值。4. 查找方式:选择精确匹配...
点击进入详情页
本回答由TableDI提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询