| 项目搜索 |
| |
|
代码片段库:
查看代码片段
浏览
| 提交新的代码片段
| 创建代码包
链接在IFRAME中显示
|
类型:
Full Script |
类别:
HTML Manipulation
|
许可证:
GNU General Public License |
语言:
JavaScript
|
描述:
下拉菜单的链接在特定的IFRAME中显示出来,实用的效果 来源:http://www.baron.com.cn
|
该代码片段的版本系列:
片段ID |
下载版本 |
提交时间 |
提交人 |
删除 |
4775 | 1.0 | 2003-10-24 04:06 | cbd001 | |
点击"下载版本"来下载该代码片段.
最新版本的代码片段: 1.0
脚本说明:
把如下代码加入<body>区域中
<script>
function showitem(id,name)
{
if (id==1){
return ("<a target=frmright href='1.htm' class='a1'>"+name+"</a><br>")
}else if(id==2){
return ("<a target=frmright href='2.htm' class='a1'>"+name+"</a><br>")
}else if(id==3){
return ("<a target=frmright href='3.htm' class='a1'>"+name+"</a><br>")
}else if (id == 4){
return ("<a target=frmright href='4.htm' class='a1'>"+name+"</a><br>")
}else if (id==5){
return ("<a target=frmright href='地址' class='a1'>"+name+"</a><br>")
}else if (id==6){
return ("<a target=frmright href='地址' class='a1'>"+name+"</a><br>")
}else if (id==11){
return ("<a target=frmright href='地址' class='a1'>"+name+"</a><br>")
}else if (id==12){
return ("<a target=frmright href='地址' class='a1'>"+name+"</a><br>")
}else if (id==21){
return ("<a target=frmright href='地址' class='a1'>"+name+"</a><br>")
}else if (id==22){
return ("<a target=frmright href='地址' class='a1'>"+name+"</a><br>")
}else if (id==31){
return ("<a target=frmright href='地址' class='a1'>"+name+"</a><br>")
}else if (id==32){
return ("<a target=frmright href='地址' class='a1'>"+name+"</a><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="0px none navy";
//document.all("outlooktitle"+i).style.background="#A5BACE"; //打开过后的显示背景色
//未激活BAR
// document.all("outlooktitle"+i).style.color="#738294";
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="#A5BACE";
//激活BAR
//document.all("outlooktitle"+number).style.color="#EFEBEF";
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="0px none navy";
// document.all("outlooktitle"+i).style.background="YELLOW";
document.all("outlooktitle"+i).style.color="black";
document.all("outlooktitle"+i).style.textalign="center";
}
}
}
function smoothout(id1,id2,id1b,id2b,stat)
{
if(stat==0){
tempinnertext1=document.all(id1b).innerHTML;
tempinnertext2=document.all(id2b).innerHTML;
document.all(id1b).innerHTML="";
document.all(id2b).innerHTML="";
outlooksmoothstat=1;
document.all(id1b).style.overflow="hidden";
document.all(id2b).style.overflow="hidden";
document.all(id1).style.height="0%";
document.all(id1).style.display="";
setTimeout("smoothout('"+id1+"','"+id2+"','"+id1b+"','"+id2b+"',"+outlookbar.inc+")",outlookbar.timedalay);
}
else
{
stat+=outlookbar.inc;
if (stat>100)
stat=100;
document.all(id1).style.height=stat+"%";
document.all(id2).style.height=(100-stat)+"%";
if (stat<100)
setTimeout("smoothout('"+id1+"','"+id2+"','"+id1b+"','"+id2b+"',"+stat+")",outlookbar.timedalay);
else
{
document.all(id1b).innerHTML=tempinnertext1;
document.all(id2b).innerHTML=tempinnertext2;
outlooksmoothstat=0;
document.all(id1b).style.overflow="auto";
document.all(id2).style.display="none";
}
}
}
function getOutLine()
{
outline="<table "+outlookbar.otherclass+" align=center>";
for (i=0;i<(outlookbar.titlelist.length);i++)
{
outline+="<tr><td align=center name=outlooktitle"+i+" id=outlooktitle"+i+" ";
if (i!=outlookbar.opentitle)
outline+=" nowrap align=center bgcolor='c0c0c0' style='cursor:hand;height:18;border:0 none navy' ";
else
outline+=" nowrap align=center bgcolor='c0c0c0' style='cursor:hand;background-color:#005D99;color:white;height:18;border:0 none white' ";
outline+=outlookbar.titlelist[i].otherclass
outline+=" onclick='switchoutlookBar("+i+")'>";
outline+=outlookbar.titlelist[i].title+"</td></tr>";
//显示分论坛内容的表格(down)
outline+="<tr><td align=center name=outlookdiv"+i+" valign=top align=center id=outlookdiv"+i+" style='width:108"
if (i!=outlookbar.opentitle)
outline+=";display:none;height:0%;";
else
outline+=";display:;height:100%;";
outline+="'><div name=outlookdivin"+i+" id=outlookdivin"+i+" style='overflow:auto;width:108;height:100%'>";
for (j=0;j<outlookbar.itemlist[i].length;j++)
outline+=showitem(outlookbar.itemlist[i][j].key,outlookbar.itemlist[i][j].title);
outline+="</div></td></tr>"
}
//初始状态的表格(d)
outline+="<tr><td align=center name=blankdiv valign=top align=center id=blankdiv style='height:100%;width:108:"
if (outlookbar.opentitle!=-1)
outline+=";display:none;";
else
outline+=";display:;";
outline+="'><div style='overflow:auto;width:108;height:100%'>";
outline+="</div></td></tr>"
outline+="</table>"
return outline
}
function show()
{
var outline;
outline="<div id=outLookBarDiv name=outLookBarDiv style='width=108;height:100%'>"
outline+=outlookbar.getOutLine();
outline+="</div>"
document.write(outline);
}
function theitem(intitle,instate,inkey)
{
this.state=instate;
this.otherclass=" nowrap align=center";
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=center style='backgroundColor:blue;height:5' ";
return(outlookbar.itemlist[parentid].length-1);
}
else
additem=-1;
}
function outlook()
{
this.titlelist=new Array();
this.itemlist=new Array();
this.divstyle="style='height:100%;width:108;overflow:auto' align=center";
this.otherclass="border=0 cellspacing='0' cellpadding='0' style='height:100%;width:108'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;
}
function outreflesh()
{
document.all("outLookBarDiv").innerHTML=outlookbar.getOutLine();
}
function locatefold(foldname)
{
for (var i=0;i<outlookbar.titlelist.length;i++)
if(foldname==outlookbar.titlelist[i].title)
{
outlookbar.starttitle=i;
outlookbar.opentitle=i;
}
}
var outlookbar=new outlook();
var tempinnertext1,tempinnertext2,outlooksmoothstat
outlooksmoothstat = 0;
</script>
<script language="javascript">
var t;
t=outlookbar.addtitle('菜单1')
outlookbar.additem("1",t,"1","frmright")
outlookbar.additem("2",t,"2","frmright")
outlookbar.additem("3",t,"3","frmright")
outlookbar.additem("4",t,"4","frmright")
outlookbar.additem("5",t,"5","frmright")
outlookbar.additem("6",t,"6","frmright")
t=outlookbar.addtitle('菜单2')
outlookbar.additem("7",t,"11","frmright")
outlookbar.additem("8",t,"12","frmright")
t=outlookbar.addtitle('菜单3')
outlookbar.additem("9",t,"21","frmright")
outlookbar.additem("10",t,"22","frmright")
t=outlookbar.addtitle('菜单4')
outlookbar.additem("11",t,"31","frmright")
outlookbar.additem("12",t,"32","frmright")
</script>
<table border="0" cellpadding="0" cellspacing="0" width="108" height="100%" align="left">
<tr>
<td valign="bottom" align="left" width="108" background="../image/b2.gif" height="18" style="background-repeat: no-repeat; background-position: right bottom"></td>
</tr>
<tr>
<td style="border: 1 solid #000000" id="outLookBarShow" name="outLookBarShow" valign="top" align="left" bgcolor="#A5D5CA" width="108" style="" ><font color="#ffffff">
<script>
outlookbar.show()
</script></font>
</td>
</tr>
</table>
<iframe style="position:absolute;top:0;left:150;height:100%;width:500" name="frmright"></iframe>
如果您修改了一个代码片段并且觉得很应该让别人共享,您可以把这作为这个代码片段的最新版本提交上来. |
|