动态导航栏问题2

飞火流星02027 2009-04-25 08:33:13
在页面有使用outlookbar.show()与在javascript中的方法中使用outlookbar.show()的差别问题或都与使用setTimeout("outlookbar.show()",6000);的差别问题!!

<html>
<head>
<title>My JSP 'leftnav.jsp starting page</title>
<STYLE type="text/css">
A:link { COLOR: #000000; FONT-SIZE: 12px; TEXT-DECORATION: none}
A:visited { COLOR: #000000; FONT-SIZE: 12px; TEXT-DECORATION: none}
A:hover { COLOR: #006CD9; FONT-SIZE: 12px; TEXT-DECORATION: none}
BODY { FONT-SIZE: 12px;}
TD { FONT-SIZE: 12px; line-height: 150%}
</style>
<script type="text/javascript" src="js/findnav.js"></script>
</head>

<body>
<table id=mnuList style="WIDTH:150px;HEIGHT: 100%" cellspacing=0 cellpadding=0 align=center border=0>
<tr>
<td bgcolor=#F0F0E5 id=outLookBarShow style="HEIGHT: 100%" valign=top align=middle name="outLookBarShow">
<script language="JavaScript">
<!--
locatefold("")
findnav()
outlookbar.show()
//setTimeout("outlookbar.show()",6000);
//-->
</script>
</td>
</tr>
</table>
</body>
</html>



findnav.js代码:

//校级管理员登陆后对左边导航栏进行初始化
function showitem(id,name)
{
return ("<span><a href='"+id+"' target=_blank>"+name+"</a></span><br>")
}
function switchoutlookBar(number)
{
var i = outlookbar.opentitle;
outlookbar.opentitle=number;
var id1,id2,id1b,id2b
if (number!=i && outlooksmoothstat==0){
if (number!=-1)
{
if (i==-1){
id2="blankdiv";
id2b="blankdiv";
}
else{
id2="outlookdiv"+i;
id2b="outlookdivin"+i;
document.all("outlooktitle"+i).style.border="1px none navy";
document.all("outlooktitle"+i).style.background=outlookbar.maincolor;
document.all("outlooktitle"+i).style.color="#ffffff";
document.all("outlooktitle"+i).style.textalign="center";
}
id1="outlookdiv"+number
id1b="outlookdivin"+number
document.all("outlooktitle"+number).style.border="1px none white";
document.all("outlooktitle"+number).style.background=outlookbar.maincolor; //title
document.all("outlooktitle"+number).style.color="#ffffff";
document.all("outlooktitle"+number).style.textalign="center";
smoothout(id1,id2,id1b,id2b,0);
}
else
{
document.all("blankdiv").style.display="";
document.all("blankdiv").sryle.height="100%";
document.all("outlookdiv"+i).style.display="none";
document.all("outlookdiv"+i).style.height="0%";
document.all("outlooktitle"+i).style.border="1px none navy";
document.all("outlooktitle"+i).style.background=outlookbar.maincolor;
document.all("outlooktitle"+i).style.color="#ffffff";
document.all("outlooktitle"+i).style.textalign="center";
}
}
}

function show()
{
var outline;
outline="<div id=outLookBarDiv name=outLookBarDiv style='width=100%;height:100%'>"
outline+=outlookbar.getOutLine();
outline+="</div>"
document.write(outline);
}
function theitem(intitle,instate,inkey)
{
this.state=instate;
this.otherclass=" nowrap ";
this.key=inkey;
this.title=intitle;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function addtitle(intitle)
{
outlookbar.itemlist[outlookbar.titlelist.length]=new Array();
outlookbar.titlelist[outlookbar.titlelist.length]=new theitem(intitle,1,0);
return(outlookbar.titlelist.length-1);
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function additem(intitle,parentid,inkey)
{
if (parentid>=0 && parentid<=outlookbar.titlelist.length)
{
outlookbar.itemlist[parentid][outlookbar.itemlist[parentid].length]=new theitem(intitle,2,inkey);
outlookbar.itemlist[parentid][outlookbar.itemlist[parentid].length-1].otherclass=" nowrap align=left style='height:5' ";
return(outlookbar.itemlist[parentid].length-1);
}
else
additem=-1;
}
//#################### third3 ###############################################
function outlook()
{
this.titlelist=new Array();
this.itemlist=new Array();
this.divstyle="style='height:100%;width:100%;overflow:auto' align=center";
this.otherclass="border=0 cellspacing='0' cellpadding='0' style='height:100%;width:100%'valign=middle align=center ";
this.addtitle=addtitle;
this.additem=additem;
this.starttitle=-1;
this.show=show;
this.getOutLine=getOutLine;
this.opentitle=this.starttitle;
this.reflesh=outreflesh;
this.timedelay=50;
this.inc=10;
this.maincolor = "#336699"
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function outreflesh()
{
document.all("outLookBarDiv").innerHTML=outlookbar.getOutLine();
}
//@@@@@@@@@@@@@@@@@@@ first 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function locatefold(foldname)
{
if (foldname=="")
foldname = outlookbar.titlelist[0].title
for (var i=0;i<outlookbar.titlelist.length;i++)
{
if(foldname==outlookbar.titlelist[i].title)
{
outlookbar.starttitle=i;
outlookbar.opentitle=i;
}
}
}
//$$$$$$$$$$$$$$$$$$$ second 2 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
var outlookbar=new outlook();
var tempinnertext1,tempinnertext2,outlooksmoothstat
outlooksmoothstat = 0;

function findnav(){
$.post("Academedzdfindnav.action",callback);
}
function callback(result){
var t;
window.alert("jjk");
alert(result);
var strA1=new Array();
var strA2= new Array();
var strA3= new Array();
strA1=result.split(",");//strA1存放每个学院的所有元素
for(var i=0;i < strA1.length; i++){
strA2[i]=strA1[i].split(" ");//将map元素分割成key和values
// alert(strA2[i][0]);
t=outlookbar.addtitle(strA2[i][0])
for(var j=0;j<strA2[i].length;j++){
outlookbar.additem(strA2[i][j+1],t,'http://linkweb.cn/js/index.asp')
}
}
//alert(strA2[4][0]);
}

t=outlookbar.addtitle("技术文档")
outlookbar.additem('Web开发',t,'http://linkweb.cn/js/index.asp')
outlookbar.additem('数据库',t,'http://linkweb.cn/js/index.asp')
t=outlookbar.addtitle('计算机技术')
outlookbar.additem('操作系统',t,'http://linkweb.cn/js/index.asp')
outlookbar.additem('网络安全',t,'http://linkweb.cn/js/index.asp')
outlookbar.additem('小技巧',t,'http://linkweb.cn/js/index.asp')
outlookbar.additem('硬件相关',t,'http://linkweb.cn/js/index.asp')
t=outlookbar.addtitle('文摘')
outlookbar.additem('求职 ',t,'http://linkweb.cn/js/index.asp')
outlookbar.additem('杂文 ',t,'http://linkweb.cn/js/index.asp')
outlookbar.additem('生活 ',t,'http://linkweb.cn/js/index.asp')
outlookbar.additem('人生 ',t,'http://linkweb.cn/js/index.asp')
outlookbar.additem('健康 ',t,'http://linkweb.cn/js/index.asp')
outlookbar.additem('知识 ',t,'http://linkweb.cn/js/index.asp')
outlookbar.additem('爱情 ',t,'http://linkweb.cn/js/index.asp')
outlookbar.additem('幽默笑话 ',t,'http://linkweb.cn/js/index.asp')
outlookbar.additem('寓言 ',t,'http://linkweb.cn/js/index.asp')
outlookbar.additem('教育 ',t,'http://linkweb.cn/js/index.asp')
outlookbar.additem('散文 ',t,'http://linkweb.cn/js/index.asp')
//javascript代码不全,可向我索要,如有有心人,与我联系:QQ:413881461
//email: dzd2746679@163.com


javascript左边航栏(模拟QQ菜单效果 )源码地址:

http://sc.jcwcn.com/tx/JsHtml/Js458.htm

在javascript中的方法中使用outlookbar.show()或在页面使用setTimeout("outlookbar.show()",6000)结果收缩效果就没有了,似乎字体的样式都变了,根本动不了,而且还会填满整个页面.......??????
...全文
199 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
archko 2009-04-28
  • 打赏
  • 举报
回复
$是它自定义的函数,prototype,jquery 也定义了相同名字的函数。
lzj34 2009-04-28
  • 打赏
  • 举报
回复
还有在你的JSP中并没有引用prototype.js
$可以正常使用吗?
lzj34 2009-04-28
  • 打赏
  • 举报
回复
总感觉你的装载数据有问题
var t;
放的位置应该是在外面,否则会找不到变量
/校级管理员登陆后对左边导航栏进行初始化
var t;
function showitem(id,name)
{
return ("<span><a href='"+id+"' target=_blank>"+name+"</a></span><br>")
}
function switchoutlookBar(number)
{
var i = outlookbar.opentitle;
outlookbar.opentitle=number;
var id1,id2,id1b,id2b
if (number!=i && outlooksmoothstat==0){
if (number!=-1)
{
if (i==-1){
id2="blankdiv";
id2b="blankdiv";
}
else{
id2="outlookdiv"+i;
id2b="outlookdivin"+i;
document.all("outlooktitle"+i).style.border="1px none navy";
document.all("outlooktitle"+i).style.background=outlookbar.maincolor;
document.all("outlooktitle"+i).style.color="#ffffff";
document.all("outlooktitle"+i).style.textalign="center";
}
id1="outlookdiv"+number
id1b="outlookdivin"+number
document.all("outlooktitle"+number).style.border="1px none white";
document.all("outlooktitle"+number).style.background=outlookbar.maincolor; //title
document.all("outlooktitle"+number).style.color="#ffffff";
document.all("outlooktitle"+number).style.textalign="center";
smoothout(id1,id2,id1b,id2b,0);
}
else
{
document.all("blankdiv").style.display="";
document.all("blankdiv").sryle.height="100%";
document.all("outlookdiv"+i).style.display="none";
document.all("outlookdiv"+i).style.height="0%";
document.all("outlooktitle"+i).style.border="1px none navy";
document.all("outlooktitle"+i).style.background=outlookbar.maincolor;
document.all("outlooktitle"+i).style.color="#ffffff";
document.all("outlooktitle"+i).style.textalign="center";
}
}
}

function show()
{
var outline;
outline="<div id=outLookBarDiv name=outLookBarDiv style='width=100%;height:100%'>"
outline+=outlookbar.getOutLine();
outline+="</div>"
document.write(outline);
}
function theitem(intitle,instate,inkey)
{
this.state=instate;
this.otherclass=" nowrap ";
this.key=inkey;
this.title=intitle;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function addtitle(intitle)
{
outlookbar.itemlist[outlookbar.titlelist.length]=new Array();
outlookbar.titlelist[outlookbar.titlelist.length]=new theitem(intitle,1,0);
return(outlookbar.titlelist.length-1);
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function additem(intitle,parentid,inkey)
{
if (parentid>=0 && parentid<=outlookbar.titlelist.length)
{
outlookbar.itemlist[parentid][outlookbar.itemlist[parentid].length]=new theitem(intitle,2,inkey);
outlookbar.itemlist[parentid][outlookbar.itemlist[parentid].length-1].otherclass=" nowrap align=left style='height:5' ";
return(outlookbar.itemlist[parentid].length-1);
}
else
additem=-1;
}
//#################### third3 ###############################################
function outlook()
{
this.titlelist=new Array();
this.itemlist=new Array();
this.divstyle="style='height:100%;width:100%;overflow:auto' align=center";
this.otherclass="border=0 cellspacing='0' cellpadding='0' style='height:100%;width:100%'valign=middle align=center ";
this.addtitle=addtitle;
this.additem=additem;
this.starttitle=-1;
this.show=show;
this.getOutLine=getOutLine;
this.opentitle=this.starttitle;
this.reflesh=outreflesh;
this.timedelay=50;
this.inc=10;
this.maincolor = "#336699"
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function outreflesh()
{
document.all("outLookBarDiv").innerHTML=outlookbar.getOutLine();
}
//@@@@@@@@@@@@@@@@@@@ first 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function locatefold(foldname)
{
if (foldname=="")
foldname = outlookbar.titlelist[0].title
for (var i=0;i<outlookbar.titlelist.length;i++)
{
if(foldname==outlookbar.titlelist[i].title)
{
outlookbar.starttitle=i;
outlookbar.opentitle=i;
}
}
}
//$$$$$$$$$$$$$$$$$$$ second 2 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
var outlookbar=new outlook();
var tempinnertext1,tempinnertext2,outlooksmoothstat
outlooksmoothstat = 0;

function findnav(){
$.post("Academedzdfindnav.action",callback);
}
function callback(result){

window.alert("jjk");
alert(result);
var strA1=new Array();
var strA2= new Array();
var strA3= new Array();
strA1=result.split(",");//strA1存放每个学院的所有元素
for(var i=0;i < strA1.length; i++){
strA2[i]=strA1[i].split(" ");//将map元素分割成key和values
// alert(strA2[i][0]);
t=outlookbar.addtitle(strA2[i][0])
for(var j=0;j<strA2[i].length;j++){
outlookbar.additem(strA2[i][j+1],t,'http://linkweb.cn/js/index.asp')
}
}
//alert(strA2[4][0]);
}

t=outlookbar.addtitle("技术文档")
outlookbar.additem('Web开发',t,'http://linkweb.cn/js/index.asp')
outlookbar.additem('数据库',t,'http://linkweb.cn/js/index.asp')
t=outlookbar.addtitle('计算机技术')
outlookbar.additem('操作系统',t,'http://linkweb.cn/js/index.asp')
outlookbar.additem('网络安全',t,'http://linkweb.cn/js/index.asp')
outlookbar.additem('小技巧',t,'http://linkweb.cn/js/index.asp')
outlookbar.additem('硬件相关',t,'http://linkweb.cn/js/index.asp')
t=outlookbar.addtitle('文摘')
outlookbar.additem('求职 ',t,'http://linkweb.cn/js/index.asp')
outlookbar.additem('杂文 ',t,'http://linkweb.cn/js/index.asp')
outlookbar.additem('生活 ',t,'http://linkweb.cn/js/index.asp')
outlookbar.additem('人生 ',t,'http://linkweb.cn/js/index.asp')
outlookbar.additem('健康 ',t,'http://linkweb.cn/js/index.asp')
outlookbar.additem('知识 ',t,'http://linkweb.cn/js/index.asp')
outlookbar.additem('爱情 ',t,'http://linkweb.cn/js/index.asp')
outlookbar.additem('幽默笑话 ',t,'http://linkweb.cn/js/index.asp')
outlookbar.additem('寓言 ',t,'http://linkweb.cn/js/index.asp')
outlookbar.additem('教育 ',t,'http://linkweb.cn/js/index.asp')
outlookbar.additem('散文 ',t,'http://linkweb.cn/js/index.asp')

要么就把
t=outlookbar.addtitle('文摘')
outlookbar.additem('求职 ',t,'http://linkweb.cn/js/index.asp')
outlookbar.additem('杂文 ',t,'http://linkweb.cn/js/index.asp')
outlookbar.additem('生活 ',t,'http://linkweb.cn/js/index.asp')
outlookbar.additem('人生 ',t,'http://linkweb.cn/js/index.asp')
outlookbar.additem('健康 ',t,'http://linkweb.cn/js/index.asp')
outlookbar.additem('知识 ',t,'http://linkweb.cn/js/index.asp')
outlookbar.additem('爱情 ',t,'http://linkweb.cn/js/index.asp')
outlookbar.additem('幽默笑话 ',t,'http://linkweb.cn/js/index.asp')
outlookbar.additem('寓言 ',t,'http://linkweb.cn/js/index.asp')
outlookbar.additem('教育 ',t,'http://linkweb.cn/js/index.asp')
outlookbar.additem('散文 ',t,'http://linkweb.cn/js/index.asp')
去了
lzj34 2009-04-28
  • 打赏
  • 举报
回复
findnav()
去掉会不会有问题?
飞火流星02027 2009-04-28
  • 打赏
  • 举报
回复
我发现我不使用ajax从数据库中取数据,就用网上下的可以用的代码,将页面中的outlookbar.show()
放在js中页面显示就没有伸缩效果了>>???>....
云水千寻 2009-04-26
  • 打赏
  • 举报
回复
帮楼主顶上去让高手看到
杨哥儿 2009-04-25
  • 打赏
  • 举报
回复
你和源码对应下.在哪里有出入了?
xiaojing7 2009-04-25
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 tantaiyizu 的回复:]
等待高手
[/Quote]、
tantaiyizu 2009-04-25
  • 打赏
  • 举报
回复
等待高手

87,921

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧