做一个类似于window右键的弹出式菜单。 代码如下: var obj; function loadobj(o) function expand() if( h<=170 ) obj.style.height=h+17; x=setTimeout(expand(), 25); var drag=0; obj.filters.item(0).apply(); expand(); function MouseMove() function MouseDown() function MouseStop() function MouseUp() document.ondblclick=Dblclick;
{
obj=o;
}
{
var h=parseInt(obj.height);
var w=parseInt(obj.width);
var op=10;
{
if( w<60 )
obj.style.width=w+6;
}
else
{
obj.style.width=60;
obj.style.height=174;
clearTimeout(x);
}
}
var move=0;
function Dblclick()
{
if (event.button==0)
{
obj.style.visibility=”visible”;
obj.style.left=window.event.x;
obj.style.top =window.event.y;
obj.style.width=0;
obj.style.height=0;
obj.filters.item(0).transition = 25;
obj.filters(0).play(0.5);
}
}
{
if(move==1)
{
obj.style.cursor=”move”;
obj.style.left=window.event.x-l;
obj.style.top=window.event.y-t;
}
}
{
if(drag)
{
l = window.event.x – parseInt(obj.style.left);
t = window.event.y – parseInt(obj.style.top);
obj.style.zIndex+=1;
move=1;
}
else
{
document.body.style.cursor=default;
obj.style.visibility=hidden;
}
}
{
window.event.returnValue=false;
}
{
move=0;
obj.style.cursor=”hand”;
}
document.onmousedown=MouseDown;
document.onmousemove=MouseMove;
document.ondragstart=MouseStop;
document.onmouseup=MouseUp;
在网页里做类似window右键的弹出式菜单_javascript教程
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 在网页里做类似window右键的弹出式菜单_javascript教程
相关推荐
- 暂无文章
