如何让向下的菜单向上?

reky369 2004-10-13 10:24:36
我的程序是这样的!
var h;
var w;
var l;
var t;
var topMar = 3;
var leftMar = -10;
var space = 2;
var isvisible;
var MENU_SHADOW_COLOR='#ffffff';
var global = window.document
global.fo_currentMenu = null
global.fo_shadows = new Array

function HideMenu()
{
var mX;
var mY;
var vDiv;
var mDiv;
if (isvisible == true)
{
vDiv = document.all("menuDiv");
mX = window.event.clientX + document.body.scrollLeft;
mY = window.event.clientY + document.body.scrollTop;
if ((mX < parseInt(vDiv.style.left)) || (mX > parseInt(vDiv.style.left)+vDiv.offsetWidth) || (mY < parseInt(vDiv.style.top)-h) || (mY > parseInt(vDiv.style.top)+vDiv.offsetHeight)){
vDiv.style.visibility = "hidden";
isvisible = false;
}
}
}

function ShowMenu(vMnuCode,tWidth) {
vSrc = window.event.srcElement;
vMnuCode = "<table id='submenu' cellspacing=1 cellpadding=3 style='width:"+tWidth+"' class=tableborder1 onmouseout='HideMenu()'><tr height=23><td nowrap align=left class=tablebody1>" + vMnuCode + "</td></tr></table>";

h = vSrc.offsetHeight;
w = vSrc.offsetWidth;
l = vSrc.offsetLeft + leftMar+4;
t = vSrc.offsetTop + topMar + h + space-2;
vParent = vSrc.offsetParent;
while (vParent.tagName.toUpperCase() != "BODY")
{
l += vParent.offsetLeft;
t += vParent.offsetTop;
vParent = vParent.offsetParent;
}

menuDiv.innerHTML = vMnuCode;
menuDiv.style.top = t;
menuDiv.style.left = l;
menuDiv.style.visibility = "visible";
isvisible = true;
makeRectangularDropShadow(submenu, MENU_SHADOW_COLOR, 4)
}

function makeRectangularDropShadow(el, color, size)
{
var i;
for (i=size; i>0; i--)
{
var rect = document.createElement('div');
var rs = rect.style
rs.position = 'absolute';
rs.left = (el.style.posLeft + i) + 'px';
rs.top = (el.style.posTop + i) + 'px';
rs.width = el.offsetWidth + 'px';
rs.height = el.offsetHeight + 'px';
rs.zIndex = el.style.zIndex - i;
rs.backgroundColor = color;
var opacity = 1 - i / (i + 1);
rs.filter = 'alpha(opacity=' + (100 * opacity) + ')';
el.insertAdjacentElement('afterEnd', rect);
global.fo_shadows[global.fo_shadows.length] = rect;
}
}

...全文
109 3 打赏 收藏 举报
写回复
3 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
reky369 2004-10-13
  • 打赏
  • 举报
回复
上面是页面里的JC
下面是HTML
<TR>
<TD width="95%" align=center valign="bottom" background="../images/11.gif"><div align="left"><a href="../default.asp" onMouseOver='ShowMenu(index)' target="_parent">     首  页</a> <IMG height=18 src="../images/head_bg1.gif" width=2 align=absMiddle> <a href="../gs/jianjie.htm" onMouseOver='ShowMenu(About)'target="_parent">企 业 简 介</a> <IMG height=17 src="../images/head_bg1.gif" width=2 align=absMiddle> <a href="../Newsall.asp" onMouseOver='ShowMenu(News)'target="_parent">新 闻 资 讯</a> <IMG height=18 src="../images/head_bg1.gif" width=2 align=absMiddle> <a href="../show-work.asp" onMouseOver='ShowMenu(Product)'target="_parent">产 品 展 示</a> <IMG height=18 src="../images/head_bg1.gif" width=2 align=absMiddle> <a href="../hnc/hnc.htm" onMouseOver='ShowMenu(img)'target="_parent">HNC 理 论</a> <IMG height=18 src="../images/head_bg1.gif" width=2 align=absMiddle> <a href="../jiameng/jiameng.htm" onMouseOver='ShowMenu(sale)'target="_parent">特 邀 加 盟</a> <IMG height=18 src="../images/head_bg1.gif" width=2 align=absMiddle> <a href="../job/job.asp" onMouseOver='ShowMenu(Job)' target="_parent">人 才 招 聘</a> <IMG height=18 src="../images/head_bg1.gif" width=2 align=absMiddle> <a href="../ORDER.ASP" onMouseOver='ShowMenu(Went)'target="_parent" >信 息 反 馈</a> <IMG height=18 src="../images/head_bg1.gif" width=2 align=absMiddle> <a href="../guestbook/index.asp" onMouseOver='ShowMenu(server)'target="_parent">客 户 服 务</a> </div></TD>
</TR>
reky369 2004-10-13
  • 打赏
  • 举报
回复
<script Language="JavaScript">
var h;
var w;
var l;
var t;
var topMar = 3;
var leftMar = -10;
var space = 2;
var isvisible;
var MENU_SHADOW_COLOR='#ffffff';
var global = window.document
global.fo_currentMenu = null
global.fo_shadows = new Array

function HideMenu()
{
var mX;
var mY;
var vDiv;
var mDiv;
if (isvisible == true)
{
vDiv = document.all("menuDiv");
mX = window.event.clientX + document.body.scrollLeft;
mY = window.event.clientY + document.body.scrollTop;
if ((mX < parseInt(vDiv.style.left)) || (mX > parseInt(vDiv.style.left)+vDiv.offsetWidth) || (mY < parseInt(vDiv.style.top)-h) || (mY > parseInt(vDiv.style.top)+vDiv.offsetHeight)){
vDiv.style.visibility = "hidden";
isvisible = false;
}
}
}

function ShowMenu(vMnuCode,tWidth) {
vSrc = window.event.srcElement;
vMnuCode = "<table id='submenu' cellspacing=1 cellpadding=3 style='width:"+tWidth+"' class=tableborder1 onmouseout='HideMenu()'><tr height=23><td nowrap align=left class=tablebody1>" + vMnuCode + "</td></tr></table>";

h = vSrc.offsetHeight;
w = vSrc.offsetWidth;
l = vSrc.offsetLeft + leftMar+4;
t = vSrc.offsetTop + topMar + h + space-2;
vParent = vSrc.offsetParent;
while (vParent.tagName.toUpperCase() != "BODY")
{
l += vParent.offsetLeft;
t += vParent.offsetTop;
vParent = vParent.offsetParent;
}

menuDiv.innerHTML = vMnuCode;
menuDiv.style.top = t;
menuDiv.style.left = l;
menuDiv.style.visibility = "visible";
isvisible = true;
makeRectangularDropShadow(submenu, MENU_SHADOW_COLOR, 4)
}

function makeRectangularDropShadow(el, color, size)
{
var i;
for (i=size; i>0; i--)
{
var rect = document.createElement('div');
var rs = rect.style
rs.position = 'absolute';
rs.left = (el.style.posLeft + i) + 'px';
rs.top = (el.style.posTop + i) + 'px';
rs.width = el.offsetWidth + 'px';
rs.height = el.offsetHeight + 'px';
rs.zIndex = el.style.zIndex - i;
rs.backgroundColor = color;
var opacity = 1 - i / (i + 1);
rs.filter = 'alpha(opacity=' + (100 * opacity) + ')';
el.insertAdjacentElement('afterEnd', rect);
global.fo_shadows[global.fo_shadows.length] = rect;
}
}
var About= ' <a style=font-size:9pt;line-height:14pt; href=\"../gs/jianjie.htm\" target="_parent"><font color="#000000">公 司 简 介</font></a> <br> <a style=font-size:9pt;line-height:14pt; href=\"../gs/wenhua.htm\" target="_parent"><font color="#000000">公 司 文 化</font></a> <br> <a style=font-size:9pt;line-height:14pt; href=\"../gs/zuzhi.htm\" target="_parent"><font color="#000000">组 织 机 构</font></a> <br> <a style=font-size:9pt;line-height:14pt; href=\"../gs/dashi.htm\" target="_parent"><font color="#000000">大 事 记 录</font></a> <br> <a style=font-size:9pt;line-height:14pt; href=\"../gs/lianxi.htm\" target="_parent"><font color="#000000">联 系 我 们</font></a> '
var News= ' <a style=font-size:9pt;line-height:14pt; href=\"../Newsall.asp\" target="_parent"><font color="#000000">企 业 新 闻</font></a> <br> <a style=font-size:9pt;line-height:14pt; href=\"../Newsall.asp\" target="_parent"><font color="#000000">业 内 资 讯</font></a> '
var Product= ' <a style=font-size:9pt;line-height:14pt; href=\"../show-work.asp\" target="_parent"<font color="#000000">产 品 展 示</font></a> <br> <a style=font-size:9pt;line-height:14pt; href=\"../download.asp\"target="_parent"><font color="#000000">资 源 下 载</font></a> '
var Soft= ' <a style=font-size:9pt;line-height:14pt; href=\"../xiazai/Soft.asp\" target="_parent"><font color="#000000">资 料 下 载</font></a> '
var Job= ' <a style=font-size:9pt;line-height:14pt; href=\"../job/job.asp\" target="_parent" target="_parent"><font color="#000000">人 才 招 聘</font></a> <br> <a style=font-size:9pt;line-height:14pt; href=\"../job/celue.htm\" target="_parent"><font color="#000000">人 才 策 略</font></a> '
var sale= ' <a style=font-size:9pt;line-height:14pt; href=\"../jiameng/jiameng.htm\" target="_parent"><font color="#000000">加 盟 程 序</font></a> <br> <a style=font-size:9pt;line-height:14pt; href=\"../jiameng/youshi.htm\" target="_parent"><font color="#000000">加 盟 优 势</font></a> '
var server= ' <a style=font-size:9pt;line-height:14pt; href=\"../fuwu.htm\" target="_parent"><font color="#000000">客 户 服 务 </font></a> <br> <a style=font-size:9pt;line-height:14pt; href=\"../guestbook/index.asp\" target="_parent"><font color="#000000">留 言 中 心</font></a> '
var index= ' <a style=font-size:9pt;line-height:14pt; href=\"../default.asp\" target="_parent"><font color="#000000">网 站 首 页</font></a> <br> <a style=font-size:9pt;line-height:14pt; href=\"../Index.htm\" target="_parent"><font color="#000000">企业形象页</font></a> '
var img= ' <a style=font-size:9pt;line-height:14pt; href=\"../hnc/anquan.htm\" target="_parent" ><font color="#000000">网 络 安 全</font></a> <br> <a style=font-size:9pt;line-height:14pt; href=\"../hnc/hnc.htm\" target="_parent"><font color="#000000">HNC 理 论</font></a> '


</script>
梅雪香 2004-10-13
  • 打赏
  • 举报
回复
这算什么程序?
给个能直接运行的
相关推荐
发帖
JavaScript

8.7w+

社区成员

Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
帖子事件
创建了帖子
2004-10-13 10:24
社区公告
暂无公告