时间:2021-05-18
复制代码 代码如下:<!--++++++++++++++++++++++++++++++在<body></body>之间输入下面的代码++++++++++++++++++++++++++++++++-->
点击右键看看!
<style>
body,td,a{font-size:9pt;color:black}
.none{border:black1pxsolid;background:D9D9D9;padding-top:2}
.over{border:black1pxsolid;background:707888;color:white;padding-top:2}
</style>
<bodyoncontextmenu="returnfalse">
<divstyle="position:absolute;left:100;top:100;cursor:hand;display='none';"ID=plane
onmousedown="down=true;divleft=event.clientX-parseInt(plane.style.left);
divtop=event.clientY-parseInt(plane.style.top)"onmouseup="down=false">
<divalign=centerstyle="position:absolute;left:150px;top:33px;width:100px;
height:19px;z-index:1;color:white;background:707888;cursor:default;"class="none"
onmouseover="menuin();init()">右键菜单</div>
<divalign=centerid="item1"style="position:absolute;left:50px;top:55px;width:99px;
height:19px;z-index:2;filter:alpha(opacity=0)"onmouseover="this.className='over';menuin()"
onmouseout="this.className='none';"class="none"
><ahref=http://.cn>网络学院</a></div>
<divalign=centerid="item2"style="position:absolute;left:250px;top:77px;width:99px;height:19px;z-index:3;filter:alpha(opacity=0)"
class=noneonmouseover="this.className='over';menuin()"
onmouseout="this.className='none';"><ahref=#>菜单项二</a></div>
<divalign=centerid="item3"style="position:absolute;left:50px;top:99px;width:99px;height:19px;z-index:4;filter:alpha(opacity=0)"
class=noneonmouseover="this.className='over';menuin()"
onmouseout="this.className='none';">菜单项三</div>
<divalign=centerid="item4"style="position:absolute;left:250px;top:121px;width:99px;height:19px;z-index:5;filter:alpha(opacity=0)"
class=noneonmouseover="this.className='over';menuin()"
onmouseout="this.className='none';">菜单项四</div> <divalign=centerid="item5"style="position:absolute;left:50px;top:143px;width:99px;height:19px;z-index:6;filter:alpha(opacity=0)"
class=noneonmouseover="this.className='over';menuin()"
onmouseout="this.className='none';">菜单项五</div>
</div>
<scriptlanguage="vbs">
dimdown,divleft,divtop,timelinestart,timelinestop,tidone,tidtwo,tidtree
down=false
timelinestart=0
timelinestop=0
subdocument_onmousedown
ifwindow.event.button=2then
plane.style.display=""
plane.style.left=window.event.clientx-153
plane.style.top=window.event.clienty-35
endif
endsub
subdocument_onmousemove
ifdownthen
plane.style.left=window.event.clientx-divleft
plane.style.top=window.event.clienty-divtop
endif
endsub
subdocument_ondargstart
window.event.returnvalue=false
endsub
functionmenuin()
cleartimeout(tidtree)
endfunction
subdocument_onclick
tidtree=settimeout("outit()",200)
endsub
functioninit()
iftimelinestart<>5then
cleartimeout(tidtwo)
item1.style.pixelLeft=item1.style.pixelLeft+20
item1.filters.alpha.opacity=item1.filters.alpha.opacity+20
item2.style.pixelLeft=item2.style.pixelLeft-20
item2.filters.alpha.opacity=item2.filters.alpha.opacity+20
item3.style.pixelLeft=item3.style.pixelLeft+20
item3.filters.alpha.opacity=item3.filters.alpha.opacity+20
item4.style.pixelLeft=item4.style.pixelLeft-20
item4.filters.alpha.opacity=item4.filters.alpha.opacity+20
item5.style.pixelLeft=item5.style.pixelLeft+20
item5.filters.alpha.opacity=item5.filters.alpha.opacity+20
timelinestart=timelinestart+1
else
cleartimeout(tidone)
endif
tidone=settimeout("init()",1)
endfunction
functionoutit()
iftimelinestart<>0then
cleartimeout(tidone)
item1.style.pixelLeft=item1.style.pixelLeft-20
item1.filters.alpha.opacity=item1.filters.alpha.opacity-20
item2.style.pixelLeft=item2.style.pixelLeft+20
item2.filters.alpha.opacity=item2.filters.alpha.opacity-20
item3.style.pixelLeft=item3.style.pixelLeft-20
item3.filters.alpha.opacity=item3.filters.alpha.opacity-20
item4.style.pixelLeft=item4.style.pixelLeft+20
item4.filters.alpha.opacity=item4.filters.alpha.opacity-20
item5.style.pixelLeft=item5.style.pixelLeft-20
item5.filters.alpha.opacity=item5.filters.alpha.opacity-20
timelinestart=timelinestart-1
else
cleartimeout(tidtwo)
plane.style.display="none"
exitfunction
endif
tidtwo=settimeout("outit()",1)
endfunction
</script>
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
C#自定义控件添加右键菜单非常简单,主要用到控件,像control定义右键菜单,用items.add()叠加右键菜单内容,用click事件处理函数。1、cont
下面先给大家介绍下js实现的右键菜单功能,具体详情如下所示:这一章解决的问题1、实现右键菜单功能代码。2、阻止默认事件的实际应用。右键菜单#menu{posit
美的极酷和酷金的区别如下: 1、美的极酷系列采用全直流变频,冷暖空调挂机是一级能效,美的酷金能效等级是二级能效。 2、美的极酷空调搭载了荣获国家专利的高频速
鼠标右键打开鼠标右键菜单,等过了几秒钟,右键菜单才突然显示出来。Win10鼠标右键很慢,这个时候该怎么办呢? 方法/步骤 1.首先右键左下角开始按钮,点击运
本文实例讲述了Javascript实现的简单右键菜单类。分享给大家供大家参考。具体如下:这是自己写的一个右键菜单类,屏蔽掉了IE固有的右键菜单,一共有四个参数: