铭瑶学习社区

首页 » 网站建设(编程语言) » JS专区 » 很酷实用的右键弹出菜单
haiou - 2008-11-14 21:42:00
<HTML xmlns:v><HEAD>
<head>
<meta http-equiv="Content-Type" c>
<title>网页特效代码---Js+DVML:很酷实用的右键弹出菜单</title>
<STYLE>
v\:*{behavior:url(#default#VML);}
.menulist{position:static;PADDING-TOP:6;LETTER-SPACING:8;HEIGHT:20;TEXT-ALIGN:center;margin-bottom:-2}
</STYLE>
</head>
<BODY oncontextmenu='return false'>
<Script>
var menutime1=null,showobjs1=null  //menutime1=循环计时器调用变量,showobjs1=绑定菜单,定时器过程执行时调用
function document.onmouseup(){if(event.button==2)menushow(menu2,60,10)}
function menushow(showobjs,showwid,showsudu){  //右键菜单展开函数
//函数说明:menushow(菜单id,项平均宽度,伸展速度)
if(menutime1!=null){clearInterval(menutime1);menutime1=null}
showobjs.style.left=event.x;showobjs.style.top=event.y;
showobjs1=showobjs.all.tags("roundrect");var showlens=showobjs1.length
for(i=0;i<showlens;i++){showobjs1.style.width=0;showobjs1.style.visibility="hidden"}
showobjs.style.display=""
menutime1=setInterval("for(i=0;i<"+showlens+";i++){showobjs1.style.visibility='';if(showobjs1.offsetWidth<"+showwid+"){showobjs1.style.width=showobjs1.offsetWidth+"+showsudu+";break;}else{if(i=="+(showlens-1)+"){clearInterval(menutime1);menutime1=null}}}",20)
}
function menuclose(showobjs2,showsudu2){  //右键菜单关闭函数
//函数说明:menushow(菜单id,关闭压缩速度)
if(menutime1!=null)return false
showobjs1=showobjs2.all.tags("roundrect");var showlens=showobjs1.length-1
menutime1=setInterval("for(i="+showlens+";i>-1;i--){if(showobjs1.offsetWidth>0){try{showobjs1.style.width=showobjs1.offsetWidth-"+showsudu2+";break;}catch(e){showobjs1.style.visibility='hidden';if(i==0){clearInterval(menutime1);menutime1=null}}}}",20)
}
</script>
<span id=menu2 style="position:absolute;Z-INDEX:40000;LEFT:395;TOP:210;color:#739EFE;cursor:hand;display:none;font-size:12px;font-family:宋体"  >
<v:roundrect class=menulist arcsize=0.5 strokecolor=#739EFE>
<v:fill type=gradient opacity=.4 color=#739EFE color2=white angle="50"/><a target=_blank href=http://js.jz123.cn>网格</a></v:roundrect>
<v:roundrect class=menulist arcsize=0.5 strokecolor=#739EFE>
<v:fill type=gradient opacity=.4 color=#739EFE color2=white angle="50"/>矩阵</v:roundrect>
<v:roundrect class=menulist arcsize=0.5 strokecolor=#739EFE>
<v:fill type=gradient opacity=.4 color=#739EFE color2=white angle="50"/>分界线</v:roundrect>
<v:roundrect class=menulist arcsize=0.5 strokecolor=#739EFE>
<v:fill type=gradient opacity=.4 color=#739EFE color2=white angle="50"/>刷新</v:roundrect>
<v:roundrect class=menulist arcsize=0.5 strokecolor=#739EFE>
<v:fill type=gradient opacity=.4 color=#739EFE color2=white angle="50"/>设置</v:roundrect>
<v:roundrect class=menulist arcsize=0.5 strokecolor=#739EFE>
<v:fill type=gradient opacity=.4 color=#739EFE color2=white angle="50"/>项</v:roundrect>
<v:roundrect class=menulist arcsize=0.5 strokecolor=#739EFE>
<v:fill type=gradient opacity=.4 color=#739EFE color2=white angle="50"/>项.</v:roundrect>
<v:roundrect class=menulist arcsize=0.5 strokecolor=#739EFE>
<v:fill type=gradient opacity=.4 color=#739EFE color2=white angle="50"/>项..</v:roundrect>
<v:roundrect class=menulist arcsize=0.5 strokecolor=#739EFE>
<v:fill type=gradient opacity=.4 color=#739EFE color2=white angle="50"/>项...</v:roundrect>
<v:roundrect class=menulist arcsize=0.5 strokecolor=#739EFE >
<v:fill type=gradient opacity=.4 color=#739EFE color2=white angle="50"/>取消</v:roundrect>
</span>
</body>
</html>
yaliujiang - 2008-11-26 21:28:00
不知道一般的网也可以直接用吗?
sucocom - 2008-12-8 10:43:00
是很实用啊  :Z1:Z1
1