#1 橫拉式選單 (隱藏 ... - 蛙 (Administrator) 發表於 13-5-2012 09:06
<FONT color=blue><P><FONT color=#0000ff size=3>如不能顯示語法效果可貼去本站</FONT><A href="http://www.bunbun000.com/html/index.htm" target=_blank><FONT color=red size=3>語法測試板</FONT></A><FONT color=#0000ff size=3>試看</FONT></P></FONT>
<P><FONT color=blue></FONT> </P>
<P><FONT color=blue></FONT> </P>
<P><FONT color=blue></FONT> </P>
<P><FONT color=blue><style>a { color: Navy; text-decoration: none }<BR>a:hover { color: red }<BR>a: { color: #808080 }<BR>div { font-family: 細明體; font-size: 12pt; font-weight: bold }<BR></style><BR><script><BR>ie=document.all?1:0<BR>n=document.layers?1:0<BR>lshow=100<BR>//How many pixels should it move every step? <BR>var move=10;<BR>//At what speed (in milliseconds, lower value is more speed)<BR>menuSpeed=40<BR>//Do you want it to move with the page if the user scroll the page?<BR>var moveOnScroll=true<BR>/********************************************************************************<BR>You should't have to change anything below this.<BR>********************************************************************************/<BR>//Defining variables<BR>var tim;<BR>var ltop;</FONT></P>
<P><FONT color=blue>//Object constructor<BR>function makeMenu(obj,nest){<BR>nest=(!nest) ? '':'document.'+nest+'.'<BR>this.css=(n) ? eval(nest+'document.'+obj):eval(obj+'.style') <BR>this.state=1<BR>this.go=0<BR>this.width=n?this.css.document.width:eval(obj+'.offsetWidth')<BR>this.left=b_getleft<BR>this.obj = obj + "Object"; eval(this.obj + "=this" <BR>}<BR>//Get's the top position.<BR>function b_getleft(){<BR>var gleft=(n) ? eval(this.css.left):eval(this.css.pixelLeft);<BR>return gleft;<BR>}<BR>/********************************************************************************<BR>Deciding what way to move the menu (this is called onmouseover, onmouseout or onclick)<BR>********************************************************************************/<BR>function moveMenu(){<BR>if(!oMenu.state){<BR>clearTimeout(tim)<BR>mIn() <BR>}else{<BR>clearTimeout(tim)<BR>mOut()<BR>}<BR>}<BR>//Menu in<BR>function mIn(){<BR>if(oMenu.left()>-oMenu.width+lshow){<BR>oMenu.go=1<BR>oMenu.css.left=oMenu.left()-move<BR>tim=setTimeout("mIn()",menuSpeed)<BR>}else{<BR>oMenu.go=0<BR>oMenu.state=1<BR>} <BR>}<BR>//Menu out<BR>function mOut(){<BR>if(oMenu.left()<0){<BR>oMenu.go=1<BR>oMenu.css.left=oMenu.left()+move<BR>tim=setTimeout("mOut()",menuSpeed)<BR>}else{<BR>oMenu.go=0<BR>oMenu.state=0<BR>} <BR>}<BR>/********************************************************************************<BR>Checking if the page is scrolled, if it is move the menu after<BR>********************************************************************************/<BR>function checkScrolled(){<BR>if(!oMenu.go) oMenu.css.top=eval(scrolled)+ltop<BR>if(n) setTimeout('checkScrolled()',30)<BR>}<BR>/********************************************************************************<BR>Inits the page, makes the menu object, moves it to the right place, <BR>show it<BR>********************************************************************************/<BR>function menuInit(){<BR>oMenu=new makeMenu('divMenu')<BR>scrolled=n?"window.pageYOffset":"document.body.scrollTop"<BR>oMenu.css.left=-oMenu.width+lshow<BR>ltop=(n)?oMenu.css.topMenu.css.pixelTop;<BR>oMenu.css.visibility='visible'<BR>if(moveOnScroll) ie?window.onscroll=checkScrolled:checkScrolled();<BR>}</FONT></P>
<P><FONT color=blue>//Initing menu on pageload<BR>onload=menuInit;<BR></script><BR></head></FONT></P>
<P><FONT color=blue><center><BR><div id="divMenu" style="position:absolute; top:200; left:30; height:100; width:550; visibility:hidden"><BR><a href="</FONT><A href="http://www.bunbun000.com/"><FONT color=blue>http://www.bunbun000.com/</FONT></A><FONT color=blue>">【笨笨網站】</a><BR><a href="</FONT><A href="http://www.bunbunhk.com/BBS/Discuz/index.php"><FONT color=blue>http://www.bunbunhk.com/BBS/Discuz/index.php</FONT></A><FONT color=blue>">【笨網論壇】</a><BR><a href="</FONT><A href="http://www.bunbunhk.com/cgi-bin/html/index.htm"><FONT color=blue>http://www.bunbunhk.com/cgi-bin/html/index.htm</FONT></A><FONT color=blue>">【語法測試】</a><BR><a href="</FONT><A href="http://www.bunbunhk.com/bg.htm"><FONT color=blue>http://www.bunbunhk.com/bg.htm</FONT></A><FONT color=blue>">【免費資源】</a><BR><a href="javascript://" onclick="moveMenu()">【隱藏選單】</a> <BR></div></FONT> </P>
<P> </P>
<P> </P>
<P><FONT color=purple></FONT> </P>
<P><FONT color=purple>可自行加減連結頁面</FONT></P>
<P> </P>
<P><FONT color=purple>width:550 <<<如選單展示不正常(因字數不同),可設調整此選單之闊度</FONT></P>
<P><FONT color=purple></FONT> </P>
<P><FONT color=purple>如連結要另開新頁可將 a href 改為 a target="_blank" href</FONT></P>
<P><FONT color=#800080></FONT> </P>
<P><FONT color=#800080></FONT> </P>