Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[发布] 抛砖引玉-图文排行榜

[复制链接]
delos 发表于 2012-3-7 14:16:04 | 显示全部楼层 |阅读模式
自己改了一个图文的排行榜
支持dzx2.0
直接在diy里调用
代码如下
希望各位大大美化一下或者能放出更好的代码
  1. <script type="text/javascript">
  2. function nTabs(thisObj,Num){
  3.     if(thisObj.className == "active")return;
  4.     var tabObj = thisObj.parentNode.id;
  5.     var tabList = document.getElementById(tabObj).getElementsByTagName("li");
  6.     for(i=0; i <tabList.length; i++)
  7.     {
  8.         if (i == Num)
  9.         {
  10.             thisObj.className = "active";
  11.             document.getElementById(tabObj+"_Content"+i).style.display = "block";
  12.         }else{
  13.             tabList[i].className = "normal";
  14.             document.getElementById(tabObj+"_Content"+i).style.display = "none";
  15.         }
  16.     }
  17. }
  18. var show_king_id = 1;
  19. function show_king_list(e,k)
  20. {
  21.     if(show_king_id == k) return true;
  22.         o = document.getElementById("a"+show_king_id);
  23.         o.className = "bg";
  24.     e.className = " ";
  25.     show_king_id = k;
  26. }
  27. var show_kinga_id = 1;
  28. function show_kinga_list(f,l)
  29. {
  30.     if(show_kinga_id == l) return true;
  31.         o = document.getElementById("b"+show_kinga_id);
  32.         o.className = "bg";
  33.     f.className = " ";
  34.     show_kinga_id = l;
  35. }
  36. </script>
  37. <style type="text/css">
  38. *{
  39. margin: 0;
  40. padding: 0;
  41. }
  42. body {
  43. font-size:12px;
  44. font-family:Arial, Helvetica, sans-serif;
  45. color:#666666;
  46. }
  47. .door_container {
  48. width:204px; background:#fff; border:1px solid #ccc;
  49. margin:20px auto;
  50. }
  51. .door_container .TabTitle {
  52. height:30px; margin-bottom:6px;
  53. }
  54. .door_container .TabTitle li {
  55. list-style:none;
  56. float:left;
  57. width:100px;
  58. height:36px;
  59. cursor:pointer;
  60. padding-left:2px;
  61. line-height:28px;
  62. color:#7c7c7c;
  63. font-size:14px;
  64. text-align:center;
  65. font-weight:bold;
  66. background:#DDDDDD;
  67. }
  68. .door_container .TabTitle .active {
  69. color:#339966;
  70. background:#fff;
  71. }
  72. .door_container .TabTitle .normal {
  73. color:#7c7c7c;
  74. }
  75. .door_container .TabContent {
  76. width:198px; background:#fff; padding:3px;
  77. }
  78. .none {
  79. display: none;
  80. }
  81. .star{
  82. width:198px;
  83. overflow:hidden;
  84. white-space:nowrap;
  85. text-overflow:ellipsis;
  86. }
  87. .star dl{
  88. width:198px;
  89. margin:2px 0;
  90. float:left;
  91. }
  92. .star dl dd{
  93. float:left;
  94. margin-left:8px;
  95. line-height:18px;
  96. }
  97. .star dl dt{
  98. float:left;
  99. }
  100. .bg{
  101. width:198px;
  102. margin:2px 0;
  103. background:#e1e1e1;
  104. float:left;
  105. }
  106. .sl01{
  107. background:#339966;
  108. margin:15px 5px 0 5px;
  109. width:25px;
  110. height:18px;
  111. padding-top:7px;
  112. text-align:center;
  113. font-weight:bold;
  114. color:#FFF;
  115. }
  116. .sl02 img{
  117. border:1px solid #999999;
  118. padding:3px;
  119. }
  120. .sl03 a{

  121. text-decoration:underline;
  122. }
  123. .sl03 a:hover{
  124. color:#FF0084;
  125. text-decoration:none;
  126. }
  127. .sl04{
  128. background:#CCCCCC;
  129. }
  130. .sl05{
  131. color:#FF0084;
  132. }
  133. .bg .sl01{
  134. background:#fff;
  135. margin:5px 5px 0 5px;
  136. width:25px;
  137. height:18px;
  138. padding-top:7px;
  139. text-align:center;
  140. font-weight:bold;
  141. color:#339966;
  142. }
  143. .bg .sl02 img{
  144. display:none;
  145. }
  146. .bg .sl03{
  147. width:140px;
  148. }
  149. .bg .sl04{
  150. background:#CCCCCC;
  151. width:155px;
  152. }
  153. .bg .sl05{
  154. display:none;
  155. }
  156. </style>
  157.         <div id=myTab_Content0>
  158.             <div class="star">
  159.                         [loop]
  160.                 <dl id=a1 onmouseover=show_king_list(this,1);>
  161.                   
  162.                     <dt class="sl02"><a href="{url}"><img src="{pic}" width="{picwidth}" height="{picheight}" alt="{title}" /></a><a href="{url}">{title}</a></dt>
  163.                     <dd class="sl03"></dd>
  164.                     <dd class="sl04">{dateline}</dd>
  165.                     <dd class="sl05">{summary}</dd>
  166.                 </dl>
  167.                                 [/loop]
  168.                                 [order=1]
  169.                 <dl class=bg id=a2 onmouseover=show_king_list(this,2);>

  170.                     <dt class="sl02"><a href="{url}"><img src="{pic}" width="{picwidth}" height="{picheight}" alt="{title}" /></a></dt>
  171.                     <dd class="sl03"><a href="{url}">{title}</a></dd>
  172.                     <dd class="sl04">{dateline}</dd>
  173.                     <dd class="sl05">{summary}</dd>
  174.                 </dl>
  175.                                 [/order]
  176.                                 [order=2]
  177.                 <dl class=bg id=a3 onmouseover=show_king_list(this,3);>
  178.                     
  179.                     <dt class="sl02"><a href="{url}"><img src="{pic}" width="{picwidth}" height="{picheight}" alt="{title}" /></a></dt>
  180.                     <dd class="sl03"><a href="{url}">{title}</a></dd>
  181.                     <dd class="sl04">{dateline}</dd>
  182.                     <dd class="sl05">{summary}</dd>
  183.                 </dl>
  184.                                 [/order]
  185.                                 [order=3]
  186.                 <dl class=bg id=a4 onmouseover=show_king_list(this,4);>
  187.                     
  188.                     <dt class="sl02"><a href="{url}"><img src="{pic}" width="{picwidth}" height="{picheight}" alt="{title}" /></a></dt>
  189.                     <dd class="sl03"><a href="{url}">{title}</a></dd>
  190.                     <dd class="sl04">{dateline}</dd>
  191.                     <dd class="sl05">{summary}</dd>
  192.                 </dl>
  193.                                 [/order]
  194.                                 [order=4]
  195.                 <dl class=bg id=a5 onmouseover=show_king_list(this,5);>
  196.                   
  197.                     <dt class="sl02"><a href="{url}"><img src="{pic}" width="{picwidth}" height="{picheight}" alt="{title}" /></a></dt>
  198.                     <dd class="sl03"><a href="{url}">{title}</a></dd>
  199.                     <dd class="sl04">{dateline}</dd>
  200.                     <dd class="sl05">{summary}</dd>
  201.                 </dl>
  202.                                 [/order]
  203.                                 [order=5]
  204.                 <dl class=bg id=a6 onmouseover=show_king_list(this,6);>
  205.                     
  206.                     <dt class="sl02"><a href="{url}"><img src="{pic}" width="{picwidth}" height="{picheight}" alt="{title}" /></a></dt>
  207.                     <dd class="sl03"><a href="{url}">{title}</a></dd>
  208.                     <dd class="sl04">{dateline}</dd>
  209.                     <dd class="sl05">{summary}</dd>
  210.                 </dl>
  211.                                 [/order]
  212.                                 [order=6]
  213.                 <dl class=bg id=a7 onmouseover=show_king_list(this,7);>
  214.                   
  215.                     <dt class="sl02"><a href="{url}"><img src="{pic}" width="{picwidth}" height="{picheight}" alt="{title}" /></a></dt>
  216.                     <dd class="sl03"><a href="{url}">{title}</a></dd>
  217.                     <dd class="sl04">{dateline}</dd>
  218.                     <dd class="sl05">{summary}</dd>
  219.                 </dl>
  220.                                 [/order]
  221.                                 [order=7]
  222.                 <dl class=bg id=a8 onmouseover=show_king_list(this,8);>

  223.                     <dt class="sl02"><a href="{url}"><img src="{pic}" width="{picwidth}" height="{picheight}" alt="{title}" /></a></dt>
  224.                     <dd class="sl03"><a href="{url}">{title}</a></dd>
  225.                     <dd class="sl04">{dateline}</dd>
  226.                     <dd class="sl05">{summary}</dd>
  227.                 </dl>
  228.                                 [/order]
  229.                                 [order=8]
  230.                 <dl class=bg id=a9 onmouseover=show_king_list(this,9);>
  231.                     
  232.                     <dt class="sl02"><a href="{url}"><img src="{pic}" width="{picwidth}" height="{picheight}" alt="{title}" /></a></dt>
  233.                     <dd class="sl03"><a href="{url}">{title}</a></dd>
  234.                     <dd class="sl04">{dateline}</dd>
  235.                     <dd class="sl05">{summary}</dd>
  236.                 </dl>
  237.                                 [/order]
  238.                                 [order=9]
  239.                 <dl class=bg id=a10 onmouseover=show_king_list(this,10);>
  240.                     
  241.                     <dt class="sl02"><a href="{url}"><img src="{pic}" width="{picwidth}" height="{picheight}" alt="{title}" /></a></dt>
  242.                     <dd class="sl03"><a href="{url}">{title}</a></dd>
  243.                     <dd class="sl04">{dateline}</dd>
  244.                     <dd class="sl05">{summary}</dd>
  245.                 </dl>
  246.                                 [/order]
  247.                                
  248.             </div>
  249.         </div>
复制代码
 楼主| delos 发表于 2012-3-7 14:16:48 | 显示全部楼层
还有很多多余代码没有清理请自行清理
回复

使用道具 举报

无效楼层,该帖已经被删除
googlg 发表于 2013-8-2 18:02:24 | 显示全部楼层
顶lz 看了看,没看懂。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-9-22 13:31 , Processed in 0.109458 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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