这些源代码介绍JavaScript实现一些有趣的特效
源代码在线查看: 11.9 烟花效果的下拉菜单.htm
标题页
#iewrap{
position:relative;
height:30px
}
#iewrap2{
position:absolute;
}
#dropmenu03{
filter:revealTrans(Duration=1.5,Transition=12);
visibility:hide;
}
a:hover { color: #FF0000}
body { font-family: "宋体"; font-size: 9pt; text-decoration: none}
a { font-family: "宋体"; font-size: 9pt; text-decoration: none}
单击此处出现菜单
//关闭 "fade"(消隐)效果,将如下参数设置成false。
var enableeffect=true;
//菜单项
var selection=new Array();
selection[0]='第一个菜单';
selection[1]='第二个菜单';
selection[2]='第三个菜单';
selection[3]='第四个菜单';
selection[4]='第五个菜单';
if (document.layers)
document.dropmenu01.document.dropmenu02.visibility='show';
function dropit2()
{
if (document.all){
dropmenu03.style.left=document.body.scrollLeft+event.clientX-event.offsetX;
dropmenu03.style.top=document.body.scrollTop+event.clientY-event.offsetY+18;
if (dropmenu03.style.visibility=="hidden"){
if (enableeffect)
dropmenu03.filters.revealTrans.apply(); //配置特殊效果
dropmenu03.style.visibility="visible";
if (enableeffect)
dropmenu03.filters.revealTrans.play();//演示特殊效果
}
else{
hidemenu(); //隐藏菜单
}}}
function dropit(e)
{
if (document.dropmenu03.visibility=="hide")
document.dropmenu03.visibility="show";
else
document.dropmenu03.visibility="hide";
document.dropmenu03.left=e.pageX-e.layerX;
document.dropmenu03.top=e.pageY-e.layerY+19;
return false;
}
//隐藏菜单的方法
function hidemenu()
{
if (enableeffect)
dropmenu03.filters.revealTrans.stop(); //停止特效
dropmenu03.style.visibility="hidden";
}
function hidemenu2()
{document.dropmenu03.visibility="hide";}
if (document.layers){
document.dropmenu01.document.dropmenu02.captureEvents(Event.CLICK);
document.dropmenu01.document.dropmenu02.onclick=dropit;}
else if (document.all)
document.body.onclick=hidemenu;
if (document.all)
dropmenu03.style.padding='4px'
for (i=0;i document.write(selection[i])
if (document.layers){
document.dropmenu03.captureEvents(Event.CLICK);
document.dropmenu03.onclick=hidemenu2;
}