找回密码
 入学

QQ登录

只需一步,快速开始

查看: 1056|回复: 0

跳动的菜单

[复制链接]
发表于 2008-11-18 14:41:11 | 显示全部楼层 |阅读模式
  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. </style>
  96. <script type="text/javascript">
  97. lastNo=0
  98. function re(menu_no){
  99. if(lastNo!=menu_no){
  100. cur=menu_no+1
  101. lastNo=menu_no
  102. rest()
  103. }else{
  104. cur=100
  105. }
  106. document.getElementById("board"+menu_no).style.visibility="visible"
  107. }
  108. function rest(){
  109. for(i=1;i<=4;i++){
  110. document.getElementById("hor"+i).style.top=20*i;
  111. document.getElementById("board"+i).style.visibility="hidden"
  112. }
  113. menu_num=4;
  114. act=1
  115. height=120+20
  116. speed=0;
  117. posY=0;
  118. }
  119. function huke(){
  120. if(act==1&&cur<100){
  121. speed=(height-posY)*0.69+speed*0.6
  122. posY+=speed
  123. for(i=cur;i<=menu_num;i++){
  124. document.getElementById("hor"+i).style.top=posY+(i-2)*20
  125. }
  126. if(Math.abs(height-posY)<0.5){
  127. for(i=cur;i<=menu_num;i++){
  128. document.getElementById("hor"+i).style.top=height+(i-2)*20
  129. }
  130. act=0
  131. }
  132. setTimeout("huke()",50)
  133. }
  134. }
  135. </script>
  136. </head>
  137. <body>
  138. <div id="hor1" onclick="re(1);huke()">News</div>
  139. <div id="hor2" onclick="re(2);huke()">Populor</div>
  140. <div id="hor3" onclick="re(3);huke()">Sports</div>
  141. <div id="hor4" onclick="re(4);huke()">Woman</div>
  142. <div id="board1">1.由AS而想起Javascript<br />2.用Jscript写ASP有没有先天性的不足?<br />3.没有了。</div>
  143. <div id="board2">1.xhtml+css真的来了吗?<br />2.Flash取代传统网站<br />3.Flash何时才能连接数据库?</div>
  144. <div id="board3">1.程序员与小姐的10个相同。<br />2.中国的程序员与中国的足球?</div>
  145. <div id="board4">1.二十一世纪最缺的是什么?人才<br />
  146. <a href="http://www.gamvan.com" target="_blank">http://www.gamvan.com</a>
  147. <a href="http://www.gamvan.com" target="_blank">http://www.gamvan.com</a></div>
  148. </body>
  149. </html>
复制代码
您需要登录后才可以回帖 登录 | 入学

本版积分规则

QQ|Archiver|手机版|小黑屋|校园天空成立于2004年2月24日 ( 陕ICP备08000078号-8 )

GMT+8, 2025-5-11 02:12 , Processed in 0.103042 second(s), 17 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表