1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
4 <title>模仿as效果的导航菜单</title>
5 <style type="text/css">
6 <!--
7 a:link,a:visited { text-decoration: none; color: #666666 }
8 a:hover { text-decoration: underline }
9 #hor1 {
10 position:absolute;
11 left:320px;
12 top:20px;
13 width:220px;
14 height:20px;
15 z-index:1;
16 background-color: #999900;
17 }
18 #hor2 {
19 position:absolute;
20 left:320px;
21 top:40px;
22 width:220px;
23 height:20px;
24 z-index:2;
25 background-color: #FFCC00;
26 }
27 #hor3 {
28 position:absolute;
29 left:320px;
30 top:60px;
31 width:220px;
32 height:20px;
33 z-index:3;
34 background-color: #99CC00;
35 }
36 #board1 {
37 position:absolute;
38 left:320px;
39 top:40px;
40 width:220px;
41 height:120px;
42 z-index:-100;
43 background-color: #333333;
44 visibility: hidden;
45 }
46 body,td,th {
47 font-family: Verdana, Arial, Helvetica, sans-serif;
48 font-size: 12px;
49 color: #FFFFFF;
50 font-weight: bold;
51 }
52 body {
53 background-color: #666666;
54 }
55 #board2 {
56 position:absolute;
57 left:320px;
58 top:60px;
59 width:220px;
60 height:120px;
61 z-index:-90;
62 background-color: #333333;
63 visibility: hidden;
64 }
65 #board3 {
66 position:absolute;
67 width:220px;
68 height:120px;
69 z-index:-80;
70 left: 320px;
71 top: 80px;
72 background-color: #333333;
73 visibility: hidden;
74 }
75 #hor4 {
76 position:absolute;
77 left:320px;
78 top:80px;
79 width:220px;
80 height:20px;
81 z-index:4;
82 background-color: #99CCCC;
83 }
84 #board4 {
85 position:absolute;
86 left:320px;
87 top:100px;
88 width:220px;
89 height:120px;
90 z-index:-70;
91 background-color: #333333;
92 visibility: hidden;
93 }
94
95 -->
96 </style>
97 <script type="text/javascript">
98 lastNo=0
99 function re(menu_no){
100 if(lastNo!=menu_no){
101 cur=menu_no+1
102 lastNo=menu_no
103 rest()
104 }else{
105 cur=100
106 }
107 document.getElementById("board"+menu_no).style.visibility="visible"
108 }
109 function rest(){
110 for(i=1;i<=4;i++){
111 document.getElementById("hor"+i).style.top=20*i;
112 document.getElementById("board"+i).style.visibility="hidden"
113 }
114 menu_num=4;
115 act=1
116 height=120+20
117 speed=0;
118 posY=0;
119 }
120 function huke(){
121 if(act==1&&cur<100){
122 speed=(height-posY)*0.69+speed*0.6
123 posY+=speed
124 for(i=cur;i<=menu_num;i++){
125 document.getElementById("hor"+i).style.top=posY+(i-2)*20
126 }
127 if(Math.abs(height-posY)<0.5){
128 for(i=cur;i<=menu_num;i++){
129 document.getElementById("hor"+i).style.top=height+(i-2)*20
130 }
131 act=0
132 }
133 setTimeout("huke()",50)
134 }
135 }
136
137 </script>
138 </head>
139 <body>
140 <div id="hor1" onclick="re(1);huke()">News</div>
141 <div id="hor2" onclick="re(2);huke()">Populor</div>
142 <div id="hor3" onclick="re(3);huke()">Sports</div>
143 <div id="hor4" onclick="re(4);huke()">Woman</div>
144 <div id="board1">1.由AS而想起Javascript<br />2.用Jscript写ASP有没有先天性的不足?<br />3.没有了。</div>
145 <div id="board2">1.xhtml+css真的来了吗?<br />2.Flash取代传统网站<br />3.Flash何时才能连接数据库?</div>
146 <div id="board3">1.程序员与小姐的10个相同。<br />2.中国的程序员与中国的足球?</div>
147 <div id="board4">1.二十一世纪最缺的是什么?人才<br />
148 <a href="http://www.gamvan.com" target="_blank">http://www.gamvan.com</a>
149 <a href="http://www.gamvan.com" target="_blank">http://www.gamvan.com</a></div>
150 </body>
151 </html>