首页 > PHP资讯 > HTML5培训技术 > 鼠标点击的弹出式菜单

鼠标点击的弹出式菜单

HTML5培训技术

脚本说明:
把如下代码加入区域中

<script language="javascript">
var nonie4 = "noneie.htm";
//设置非ie4++以上版本浏览器的连接页面;因为改菜单只适用于IE4++;
var bAnimate = true;
//是否动态展开效果
var nStep = 10;
//动态效果速度
var nDelay = 20;
//动态效果延迟时间
var nChunk;
var useragent = navigator.userAgent;

// 如果检测浏览器不是IE4++以上版本导向上面指定的noneie页面;
if (useragent.indexOf("MSIE")==-1) {
window.location = nonie4;
} else {
if ((navigator.appVersion.substring(0,1) < 4) ||
(useragent.indexOf("Windows 3.1") != -1) ||
(useragent.indexOf("X11") != -1) ||
(useragent.indexOf("Mac") != -1))
{
window.location = nonie4;
}
}
//主函数,3个参数分别是ID标志,x,y轴坐标;
function doMenu(id, x, y) {
var thisMenu = document.all(id);


if (thisMenu == AnimatedMenu) {
window.event.cancelBubble = true;
return false;
}


if (AnimatedMenu != null) AnimatedMenu.style.display ="none";

window.event.cancelBubble = true;

// 设置MENU的位置坐标

if( x < 0) {
x = document.body.clientWidth + x;
}
thisMenu.style.left = x;
thisMenu.style.top = y;
AnimatedMenu = thisMenu;

if (bAnimate) {
// 如果前面设置了动态显示,先初始化一些参数;
thisMenu.style.clip = "rect(0 0 0 0)";
thisMenu.style.display = "block";
nChunk = nStep;
window.setTimeout("showMenu()", nDelay);
}
else {
// 不是动态显示,仅显示之;
AnimatedMenu.style.display = "";
}
}

function showMenu() {
AnimatedMenu.style.clip = "rect(0 "+ nChunk + "% " + nChunk + "%0)"
nChunk += nStep;
nChunk<=100?window.setTimeout("showMenu()",nDelay):null
}

function hideMenu(){
AnimatedMenu.style.display = "none";
AnimatedMenu = StartMenu;
window.event.cancelBubble = true;
}

function keepMenu(){
window.event.cancelBubble = true;
}

document.onmou

HTML5培训技术

本文由欣才IT学院整理发布,未经许可,禁止转载。
支持35不支持0