js 类中写onmousedown,高手请看 20
打算写一个移动层的类,发现在类里面无法执行层的onmousedown,up,等事件functionmovediv(divName,divTitle){this.div=d...
打算写一个移动层的类,发现在类里面无法执行层的onmousedown,up,等事件
function movediv(divName,divTitle){
this.div = document.getElementById(divName);
this.tit = document.getElementById(divTitle);
this.t = 0;
this.l = 0;
this.tn = 0;
this.onMouseDown = function(){
this.div.setCapture();
this.l = event.x - this.tit.style.pixelLeft;
this.t = event.y - this.tit.style.pixelTop;
this.tit.attachEvent("onmousemove",this.onMouseMove)
}
this.onMouseMove = function(){
alert(this.tit);
this.tit.style.left = event.x-this.l;
this.tit.style.top = event.x-this.t;
}
this.onMouseUp = function(){
this.tit.releseCapture();
this.tit.attachEvent("onmousemove",this.onMouseMove)
}
this.tit.attachEvent("onmousedown",this.onMouseDown)
this.tit.attachEvent("onmouseup",this.onMouseUp)
} 展开
function movediv(divName,divTitle){
this.div = document.getElementById(divName);
this.tit = document.getElementById(divTitle);
this.t = 0;
this.l = 0;
this.tn = 0;
this.onMouseDown = function(){
this.div.setCapture();
this.l = event.x - this.tit.style.pixelLeft;
this.t = event.y - this.tit.style.pixelTop;
this.tit.attachEvent("onmousemove",this.onMouseMove)
}
this.onMouseMove = function(){
alert(this.tit);
this.tit.style.left = event.x-this.l;
this.tit.style.top = event.x-this.t;
}
this.onMouseUp = function(){
this.tit.releseCapture();
this.tit.attachEvent("onmousemove",this.onMouseMove)
}
this.tit.attachEvent("onmousedown",this.onMouseDown)
this.tit.attachEvent("onmouseup",this.onMouseUp)
} 展开
3个回答
2010-09-02
展开全部
这里有一个拖动层效果
你可以参考一下
你可以参考一下
参考资料: http://www.blueidea.com/common/shoutbox/redir.asp?7=k&id=12284
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
TableDI
2024-07-18 广告
2024-07-18 广告
VLOOKUP是Excel中用于垂直查找的函数,其基本用法包括四个参数:1. 查找值:即在数据表首列中需要搜索的值。2. 数据表:包含查找值的单元格区域或数组。3. 返回值所在列数:指定返回查询区域中第几列的值。4. 查找方式:选择精确匹配...
点击进入详情页
本回答由TableDI提供
展开全部
代码问题
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
搜索artDialog~
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询