[教學]網頁左邊選單 完整版教學

Mowd 自行開發或是不錯的 PHP 程式以及 phpBB 外掛將在此處公開釋出。
● phpBB 外掛有問題,請到站長意見簿提出
● Mowd 系列程式有問題,請到Mowd PHP 程式系列開發專區提出

版主: 總版面管理員

主題已鎖定
Mowd
系統管理員
系統管理員
文章: 1828
註冊時間: 2003-07-16 6:31 PM
來自: 台灣台北
聯繫:

[教學]網頁左邊選單 完整版教學

文章 Mowd »

以下是完整的原始碼:

<style type="text/css">
<!--

#master {position:absolute; width: 200px; top: 10px; left: -120px; z-index:2; visibility:visible;}
#menu {position:absolute; width: 18px; top: 20px; left: 120px; z-index:5; visibility:visible;}
#top {position:absolute; width: 120px; top: 20px; left: 0px; z-index:5; visibility:visible;}
#screen {position:absolute; width: 120px; top: 26px; left: 0px; z-index:5; visibility:visible;}
#screenlinks {position:absolute; width: 120px; top: 26px; left: 0px; z-index:5; visibility:visible;}

-->
</style>
<style type="text/css">
<!--

.NavJump {font-family: arial; font-size: 10pt; color: #808080; text-decoration: none;}
a:link.NavJump {color : #808080;}
a:visited.NavJump {color : #808080;}
a:active.NavJump {text-decoration: none; color: #C0C0C0;}
a:hover.NavJump {text-decoration: none; color: #c0c0c0;}

-->
</style>
<script language = "javascript">
<!--

var ie = document.all ? 1 : 0
var ns = document.layers ? 1 : 0

if(ie){
document.write('<style type="text/css">')
document.write("#screen {filter:Alpha(Opacity=30);}")
document.write("</style>")
}

if(ns){
document.write('<style type="text/css">')
document.write("#master {clip:rect(0,150,250,0);}")
document.write("</style>")
}

//-->
</script>
<script language = "javascript">
<!--


var ie = document.all ? 1 : 0
var ns = document.layers ? 1 : 0


var master = new Object("element")
master.curLeft = -120; master.curTop = 10;
master.gapLeft = 0; master.gapTop = 0;
master.timer = null;

function moveAlong(layerName, paceLeft, paceTop, fromLeft, fromTop){
clearTimeout(eval(layerName).timer)

if(eval(layerName).curLeft != fromLeft){
if((Math.max(eval(layerName).curLeft, fromLeft) - Math.min(eval(layerName).curLeft, fromLeft)) < paceLeft){eval(layerName).curLeft = fromLeft}
else if(eval(layerName).curLeft < fromLeft){eval(layerName).curLeft = eval(layerName).curLeft + paceLeft}
else if(eval(layerName).curLeft > fromLeft){eval(layerName).curLeft = eval(layerName).curLeft - paceLeft}
if(ie){document.all[layerName].style.left = eval(layerName).curLeft}
if(ns){document[layerName].left = eval(layerName).curLeft}
}

if(eval(layerName).curTop != fromTop){
if((Math.max(eval(layerName).curTop, fromTop) - Math.min(eval(layerName).curTop, fromTop)) < paceTop){eval(layerName).curTop = fromTop}
else if(eval(layerName).curTop < fromTop){eval(layerName).curTop = eval(layerName).curTop + paceTop}
else if(eval(layerName).curTop > fromTop){eval(layerName).curTop = eval(layerName).curTop - paceTop}
if(ie){document.all[layerName].style.top = eval(layerName).curTop}
if(ns){document[layerName].top = eval(layerName).curTop}
}


eval(layerName).timer=setTimeout('moveAlong("'+layerName+'",'+paceLeft+','+paceTop+','+fromLeft+','+fromTop+')',30)
}

function setPace(layerName, fromLeft, fromTop, motionSpeed){
eval(layerName).gapLeft = (Math.max(eval(layerName).curLeft, fromLeft) - Math.min(eval(layerName).curLeft, fromLeft))/motionSpeed
eval(layerName).gapTop = (Math.max(eval(layerName).curTop, fromTop) - Math.min(eval(layerName).curTop, fromTop))/motionSpeed

moveAlong(layerName, eval(layerName).gapLeft, eval(layerName).gapTop, fromLeft, fromTop)
}

var expandState = 0

function expand(){
if(expandState == 0){setPace("master", 0, 10, 10); if(ie){document.menutop.src = "menub.gif"}; expandState = 1;}
else{setPace("master", -120, 10, 10); if(ie){document.menutop.src = "menu.gif"}; expandState = 0;}
}

//-->
</script>

<div id="master">

<div id="menu">
<table border="0" width="18" cellspacing="0" cellpadding="0">
<tr><td width="100%"><a href="javascript:expand()" onfocus="this.blur()" onmouseover="expand()"><img name="menutop" border="0" src="menu.gif" width="18" height="70"></a></td></tr>
</table>
</div>


<div id="top">
<table border="0" width="120" cellspacing="0" cellpadding="0">
<tr><td width="100%"><img border="0" src="top.gif" width="120" height="6"></td></tr>
</table>
</div>


<div id="screen">
<table border="0" width="120" cellspacing="0" cellpadding="5">
<tr><td width="100%" bgcolor="#808080">

<table border="0" width="100%" bgcolor="#808080" cellspacing="0" cellpadding="0">
<tr><td width="100%">

<table border="0" width="100%" cellspacing="1" cellpadding="5">
<tr><td width="100%" bgcolor="#FFFFFF">


<font class="NavJump"><br></font><font class="NavJump"><br></font>


</td></tr>
</table>

</td></tr>
</table>

</td></tr>
</table>
</div>

<div id="screenlinks">
<table border="0" width="120" cellspacing="0" cellpadding="5">
<tr><td width="100%">

<table border="0" width="100%" bgcolor="#808080" cellspacing="0" cellpadding="0">
<tr><td width="100%">

<table border="0" width="100%" cellspacing="1" cellpadding="5">
<tr><td width="100%" bgcolor="#ddf7FF">

<a href="http://www.infor.org/~n0158/in/in.htm" class="NavJump"><b>=首頁=</b></a><br>
<a href="http://www.infor.org/~n0158/phpbb/index2.php" class="NavJump"><b>=論壇=</b></a><br>
<a href="http://www.infor.org/~n0158/in/game/tw.htm" class="NavJump"><b>=我的月曆=</b></a><br>
<font class="NavJump"><b>=小遊戲=</b></font><br>
<a href="http://www.infor.org/~n0158/in/game/spe ... ellpic.htm" class="NavJump"><b> ├ 拼圖遊戲</b></a><br>
<a href="http://www.infor.org/~n0158/in/game/e/e.htm" class="NavJump"><b> └ 小精靈</b></a><br>
<a href="http://www.infor.org/~n0158/phpbb/mods/ ... panded.php" class="NavJump"><b>=線上聊天室=</b></a><br>
<a href="http://www.infor.org/~n0158/in/report.php" class="NavJump"><b>=給我建議..=</b></a><br>

<font class="NavJump">尚在建設中...</font>


</td></tr>
</table>

</td></tr>
</table>

</td></tr>
</table>
</div>

</div>

<script language = "javascript">
<!--


if(ie){var sidemenu = document.all.master;}
if(ns){var sidemenu = document.master;}

function FixY(){
if(ie){sidemenu.style.top = document.body.scrollTop+10}
if(ns){sidemenu.top = window.pageYOffset+10}
}


setInterval("FixY()",100);

//-->
</script>
---------------結束--------------------

把這段原始碼複製到overall_footer.tpl就好了。
其中的連結可以改成你想要的,如果你不想當滑鼠移過去就將MENU展開的話,就將紅色字的部分刪掉。
主題已鎖定