首页 > 语言 > JavaScript > 正文

js实现精美的银灰色竖排折叠菜单

2024-05-06 16:20:27
字体:大 中 小
来源:转载
供稿:网友

这篇文章主要介绍了js实现精美的银灰色竖排折叠菜单,可实现页面左侧竖排的纵向折叠菜单效果,非常美观实用,需要的朋友可以参考下

本文实例讲述了js实现精美的银灰色竖排折叠菜单。分享给大家供大家参考。具体实现方法如下:

 

 
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
  2. <html xmlns="http://www.w3.org/1999/xhtml"> 
  3. <head> 
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
  5. <title>网页左边的竖式菜单</title> 
  6. <style> 
  7. body 
  8. { 
  9. background-color:#F3F3F3; 
  10. margin:0px; 
  11. font-size: 9pt; 
  12. background-position:center; 
  13. text-decoration: none; 
  14. scrollbar-face-color: #f6f6f6; 
  15. scrollbar-highlight-color: #ffffff; scrollbar-shadow-color: #EEEEEE;  
  16. scrollbar-3dlight-color: #EEEEEE; scrollbar-arrow-color: #330000;  
  17. scrollbar-track-color: #f6f6f6;  
  18. scrollbar-darkshadow-color: #ffffff; 
  19. } 
  20. /* 网站链接总的css定义*/ 
  21. a{text-decoration: underline;} 
  22. a:link {color: #595989;} 
  23. a:visited {color: #595989;}  
  24. a:hover{color: #ff0000;}  
  25. a:active {color: #595989;}  
  26. .dt1, .dt2, .dt3, .dt4 ,.dt{ 
  27. padding: 0px; margin: 0px; border: 0px; padding-left: 25px; 
  28. border-left: 5px solid #c0c0c0;  
  29. border-top: 1px solid #ffffff;  
  30. border-bottom: 1px solid #c0c0c0; 
  31. width: auto;text-align: left; 
  32. line-height: 26px; 
  33. height: 26px; 
  34. background: #E0E0E0; 
  35. cursor:pointer!important; 
  36. cursor:hand; 
  37. display:block; 
  38. } 
  39. /*这里可以加入背景图片 
  40. .dt1{ 
  41. background-image: url(); 
  42. background-repeat: no-repeat; 
  43. background-position: right center; 
  44. } 
  45. .dt{ 
  46. background-image: url(); 
  47. background-repeat: no-repeat; 
  48. background-position: 8px center; 
  49. } 
  50. .dt2{ 
  51. background-image: url(); 
  52. background-repeat: no-repeat; 
  53. background-position: right center; 
  54. } 
  55. .dt4{ 
  56. background-image: url(); 
  57. background-repeat: no-repeat; 
  58. background-position: right center; 
  59. } 
  60. .dt3{ 
  61. background-image: ur(); 
  62. background-repeat: no-repeat; 
  63. background-position: right center; 
  64. }*/ 
  65. #aboutbox { /*左侧box*/ 
  66. padding: 0px; margin: 0px; border: 0px; 
  67. width: 190px;  
  68. float: left; 
  69. background: #eee; 
  70. } 
  71. #aboutbox dl { /*dl、dt、dd*/ 
  72. margin: 0px; border: 0px; 
  73. border: medium none; /*不显示边框*/ 
  74. background:#eeeeee; 
  75. background-image: url();/*背景图像,这里省略了*/ 
  76. background-repeat: repeat-y; 
  77. background-position: left; 
  78. clear: both; 
  79. } 
  80. #aboutbox dd { 
  81. padding: 0px; margin: 0px; border: 0px; 
  82. background: #eee; 
  83. border-top: 1px solid #fff; 
  84. border-left: 5px solid #e0e0e0; 
  85. padding-right:3px; 
  86. } 
  87. #aboutbox ul { /*ul、li定义*/ 
  88. padding: 0px; 
  89. margin: 0px;  
  90. border: 0px; 
  91. list-style-type: none;  
  92. } 
  93. #aboutbox li { 
  94. padding: 0px; margin: 0px; border: 0px; 
  95. text-align: left; 
  96. text-indent: 10px; 
  97. list-style:none; 
  98. } 
  99. #aboutbox li a { 
  100. padding-left: 5px; margin: 0px; border: 0px; 
  101. display: block; 
  102. background: #eee; 
  103. font-weight: normal;height: 22px;line-height: 22px; 
  104. color: #000; 
  105. border: 1px solid #eee; 
  106. text-decoration: none;} 
  107. #aboutbox li a:link,#aboutbox li a:visited { 
  108. height: 22px;line-height: 22px;} 
  109. #aboutbox li a:hover { 
  110. padding-left: 5px; 
  111. background-color: #e4e4e4; 
  112. border: 1px solid #999999; 
  113. color: #D90000;height: 22px;line-height: 22px;} 
  114. #aboutbox li a:active { 
  115. color: #333333;height: 22px;line-height: 22px;background: #EEEEEE; 
  116. } 
  117. .center_tdbgall /* 中部表格背景颜色 */ 
  118. { 
  119. background:#ffffff; 
  120. } 
  121. </style> 
  122. </head> 
  123. <body> 
  124. <table class="center_tdbgall" width="191" border="0" 
  125. cellspacing="0" cellpadding="0"> 
  126. <tr> 
  127. <td width=191 rowspan="2" valign=top class="web_left_all"> 
  128. <div id=aboutbox> 
  129. <dl> 
  130. <dt class="dt1" id=dt1 onmouseover=showbg(1) 
  131. onclick=showsubmenu(1) onmouseout=showoutbg(1)><B>网站动态</B> 
  132. <dd id=submenu1> 
  133. <ul> 
  134. <LI><A href='/'>今日关注</A></LI> 
  135. <LI><A href='/'>最新整理</A></LI> 
  136. <LI><A href='/'>下载排行</A></LI> 
  137. </ul> 
  138. </dd> 
  139. </dt> 
  140. </dl> 
  141. <dl> 
  142. <dt class="dt2" id=dt2 onmouseover=showbg(2)  
  143. onclick=showsubmenu(2) onmouseout=showoutbg(2)><B>管理新闻</B> 
  144. <dd id=submenu2> 
  145. <ul> 
  146. <LI><A href='/'>新闻分类</A></LI> 
  147. <LI><A href='/'>新闻列表</A></LI> 
  148. <LI><A href='/'>审核新闻</A></LI> 
  149. </ul> 
  150. </dd> 
  151. </dt> 
  152. </dl> 
  153. <script> 
  154. function showsubmenu(sid){ 
  155. whichEl = eval('submenu' + sid); 
  156. if (whichEl.style.display == 'none'){ 
  157. eval("submenu" + sid + ".style.display='';"); 
  158. eval("dt" + sid + ".className='dt2';"); 
  159. } 
  160. else{ 
  161. eval("submenu" + sid + ".style.display='none';"); 
  162. eval("dt" + sid + ".className='dt1';"); 
  163. } 
  164. } 
  165. function showbg(sid){ 
  166. whichEl = eval('submenu' + sid); 
  167. if (whichEl.style.display == 'none'){ 
  168. eval("dt" + sid + ".className='dt4';"); 
  169. } 
  170. else{ 
  171. eval("dt" + sid + ".className='dt3';"); 
  172. } 
  173. } 
  174. function showoutbg(sid){ 
  175. whichEl = eval('submenu' + sid); 
  176. if (whichEl.style.display == 'none'){ 
  177. eval("dt" + sid + ".className='dt1';"); 
  178. } 
  179. else{ 
  180. eval("dt" + sid + ".className='dt2';"); 
  181. } 
  182. } 
  183. </script>  
  184. </div></TD> 
  185. </tr> 
  186. </table> 
  187. </body> 
  188. </html> 

希望本文所述对大家的javascript程序设计有所帮助。

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表

图片精选