社区
Web 开发
帖子详情
在jsp中怎么实现类似qq的菜单?
hdczf
2003-08-18 05:12:26
如题,最好能提供实例,谢谢!
...全文
21
3
打赏
收藏
在jsp中怎么实现类似qq的菜单?
如题,最好能提供实例,谢谢!
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
3 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
seabell
2003-08-19
打赏
举报
回复
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body onload=constructmenu(); bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="778" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="124">
<UL id=mytree style="DISPLAY: none">
<LI value=Mail>
<UL HREF="contents.htm" VALUE="InBox" IMGSRC="inbox.gif"></UL>
<UL HREF="contents.htm" VALUE="OutBox" IMGSRC="outbox.gif"></UL>
<UL HREF="contents.htm" VALUE="Sent" IMGSRC="sentitems.gif"></UL>
<UL HREF="contents.htm" VALUE="Deleted" IMGSRC="deleted.gif"></UL>
<LI value=Contacts>
<UL HREF="contents.htm" VALUE="Contacts" IMGSRC="contacts.gif"></UL>
<LI value=Other>
<UL HREF="contents.htm" VALUE="Journal" IMGSRC="journal.gif"></UL>
<UL HREF="contents.htm" VALUE="Tasks" IMGSRC="tasks.gif"></UL>
<UL HREF="contents.htm" VALUE="Notes" IMGSRC="notes.gif"></UL>
<UL HREF="contents.htm" VALUE="Calendar" IMGSRC="calendar.gif"></UL>
</LI>
<LI value=Othdddder>
<UL HREF="contents.htm" VALUE="Journal" IMGSRC="journal.gif"></UL>
<UL HREF="contents.htm" VALUE="Tasks" IMGSRC="tasks.gif"></UL>
<UL HREF="contents.htm" VALUE="Notes" IMGSRC="notes.gif"></UL>
<UL HREF="dfef" VALUE="Calendar" IMGSRC="calendar.gif"></UL>
</LI>
</UL>
<SCRIPT language=javascript>
<!--
//Size of buttons.
var BTN_HEIGHT = 25;
var BTN_WIDTH = 100;
//Space between buttons.
var BTN_SPACE = 1;
var ITM_HEIGHT = 80;
var ITM_SPACE = 2;
var ButtonCount = 0;
var ItemCounts;
var FocusButton;
//reset postion of buttons and items, show clicked button's items, hide other items.
function onBtnClick(btnIndex)
{
var i;
var minHeight;
var btmBtnTop;
if ((btn < 0) || (btn >= ButtonCount)) return;
document.body.scrollTop = 0;
for(i=0; i<=btnIndex; i++)
{
var btn = document.all.item("BTN" + i);
if (btn == null)
alert("NULL BTN");
else
btn.style.posTop = i * (BTN_HEIGHT + BTN_SPACE);
};
//minimun height used by buttons and items.
minHeight = ButtonCount * (BTN_HEIGHT + BTN_SPACE) - BTN_SPACE + ItemCounts[btnIndex] * (ITM_HEIGHT + ITM_SPACE);
//calculate bottom button's start top position.
if (minHeight > document.body.clientHeight)
{
document.body.setAttribute("SCROLL", "YES", false);
btmBtnTop = (btnIndex+1) * (BTN_HEIGHT + BTN_SPACE) - BTN_SPACE + ItemCounts[btnIndex] * (ITM_HEIGHT + ITM_SPACE);
}
else
{
document.body.setAttribute("SCROLL", "NO", false);
btmBtnTop = document.body.clientHeight - (ButtonCount - btnIndex -1) * (BTN_HEIGHT + BTN_SPACE);
}
for(i=btnIndex + 1; i<ButtonCount; i++)
{
var btn = document.all.item("BTN" + i);
if (btn == null)
alert("NULL BTN");
else
btn.style.posTop = btmBtnTop;
btmBtnTop += (BTN_HEIGHT + BTN_SPACE);
};
var itmtop = (BTN_HEIGHT + BTN_SPACE) * (btnIndex + 1);
for(i=0; i<ButtonCount; i++)
for(j=0; j<ItemCounts[i]; j++)
{
var tbl = document.all.item("ITM" + i + "_" + j);
if (null == tbl) continue;
if (i == btnIndex)
{
tbl.style.posTop = itmtop + j * (ITM_HEIGHT + ITM_SPACE);
tbl.style.visibility = "visible";
}
else
tbl.style.visibility = "hidden";
//tbl.style.display = "none";
}
FocusButton = btnIndex;
};
function onResize()
{
onBtnClick(FocusButton);
}
function constructmenu()
{
var i,j;
var str;
str = "";
ItemCounts = new Array();
for(i=0; i<mytree.children.length; i++)
{
var item = mytree.children.item(i);
str += '<INPUT TYPE="BUTTON" '+
'ID="BTN' + i + '" '+
'VALUE="' + item.getAttribute("VALUE") +'" ' +
'STYLE="position:absolute; HEIGHT: ' + BTN_HEIGHT + 'px; WIDTH: ' + BTN_WIDTH + 'px;" ' +
'ONCLICK="onBtnClick(' + i +');' +
'">';
str += '\n<BR>';
ItemCounts[i] = 0;
for(j=0; j < item.children.length; j++)
{
str += '<TABLE WIDTH=' + BTN_WIDTH + ' ID="ITM' + i + '_' + j + '" STYLE="position:absolute;">';
str += '<TR><TD ALIGN=CENTER>';
str += '<A HREF=' + item.children.item(j).getAttribute("HREF") + ' TARGET="CONTENTS">';
str += '<IMG SRC="' + item.children.item(j).getAttribute("IMGSRC") + '" ALIGN=CENTER STYLE="border:none;">';
str += '</A>';
str += '</TD></TR>';
str += '<TR><TD ALIGN=CENTER>';
str += item.children.item(j).getAttribute("VALUE");
str += '</TD></TR>';
str += '</TABLE>';
ItemCounts[i] ++;
}
ButtonCount ++;
}
menu.outerHTML = str; onBtnClick(0);
//menu.innerText = str;
FocusButton = 0;
window.onresize = onResize;
}
//-->
</SCRIPT>
<DIV id=menu></DIV>
</td>
<td width="654"> </td>
</tr>
</table>
</body>
</html>
hdczf
2003-08-19
打赏
举报
回复
十分感谢seabell(百合心)!!!!
hdczf
2003-08-18
打赏
举报
回复
re
JSP
实用技巧集合,
jsp
编程的一些小技巧总结
15. 在
jsp
中
,怎么
实现
按回车就可提交表单? 16. 在
JSP
中
如何传递数组? 17. 按地址取图片? 18.
JSP
中
如何上传图片到数据库字段? 19. 页面自动刷新? 20. 表单自动提交? 21. 从
JSP
传数据的到JAVABEAN里? 22. ...
jsp
编程技巧集锦
在
jsp
中
,怎么
实现
按回车就可提交表单? 16. 在
JSP
中
如何传递数组? 17. 按地址取图片? 18.
JSP
中
如何上传图片到数据库字段? 19. 页面自动刷新? 20. 表单自动提交? 21. 从
JSP
传数据的到JAVABEAN...
java源码包2
在有状态SessionBean
中
,用累加器,以对话状态存储起来,创建EJB对象,并将当前的计数器初始化,调用每一个EJB对象的count()方法,保证Bean正常被激活和钝化,EJB对象是用完毕,从内存
中
清除…… Java Socket 聊天...
用ajax
实现
在单击事件下加载一个DIV层的脚本
您可能感兴趣的文章:jquery ajax双击div可直接修改div
中
的内容ajax
实现
点击不同的链接让返回的内容显示在特定div里ajax局部刷新一个div下
jsp
内容的方法div弹出层的ajax登录(Jquery版+c#)基于Ajax+div的“左边
菜单
、...
java源码包---java 源码 大量 实例
在有状态SessionBean
中
,用累加器,以对话状态存储起来,创建EJB对象,并将当前的计数器初始化,调用每一个EJB对象的count()方法,保证Bean正常被激活和钝化,EJB对象是用完毕,从内存
中
清除…… Java Socket 聊天...
Web 开发
81,090
社区成员
341,731
社区内容
发帖
与我相关
我的任务
Web 开发
Java Web 开发
复制链接
扫一扫
分享
社区描述
Java Web 开发
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章