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

 找回密码
 立即注册
搜索

[疑难] 谁给解释下这个触显JS代码是怎么回事..

[复制链接]
pingdaye 发表于 2009-3-12 18:04:04 | 显示全部楼层 |阅读模式
....以前用PHP168的时候一位牛人做的触显代码..

有没有高手能给SS7也做一个啊?~

..我是菜鸟,不懂这个..
  1. /******************************************
  2.   触显JS代码 以下部分加在index.htm中的
  3.    <!--
  4.    <?php
  5.    print <<<EOT
  6.    -->
  7.    后
  8. *******************************************/

  9. <SCRIPT language=javascript>
  10.     function show_intro(pre,pree, n, select_n,css) {
  11.         for (i = 1; i <= n; i++) {
  12.             var intro = document.getElementById(pre + i);
  13.    var cha = document.getElementById(pree + i);
  14.             intro.style.display = "none";
  15.             cha.className=css + "_off";
  16.             if (i == select_n) {
  17.                 intro.style.display = "block";
  18.   cha.className=css + "_on";
  19.             }
  20.         }
  21.     }
  22. </SCRIPT>

  23. /******************************************
  24.   触显CSS代码 以下部分加在css.css中
  25.   图片大小:62×28
  26. *******************************************/

  27. .hot_off {
  28.    BACKGROUND: url(ty1.gif) no-repeat;
  29.    width:62px;
  30.    height:18px;
  31.    padding-top:10px;
  32. }
  33. .hot_on {
  34.    BACKGROUND: url(ty2.gif) no-repeat;
  35.    width:62px;
  36.    height:18px;
  37.    padding-top:10px;
  38. }

  39. /******************************************
  40.   页面代码,以下部分加在index.htm中
  41. *******************************************/

  42. <table width="100%" border="0" cellspacing="0" cellpadding="0" class="dragTable">
  43.   <tr>
  44.     <td class="head">
  45.       <h3 class="L"></h3>
  46.         <div class="hot_on" id=tzm1 onmouseover="show_intro('ytld','tzm',4,1,'hot')" style="float:left;">
  47.           <a href="/list.php?fid=31">工作动态</a></div>
  48.         <div class="hot_off" id=tzm2 onmouseover="show_intro('ytld','tzm',4,2,'hot')" style="float:left;margin-left:6px;">
  49.           <a href="/list.php?fid=27">盐亭新闻</a></div>
  50.         <div class="hot_off" id=tzm3 onmouseover="show_intro('ytld','tzm',4,3,'hot')" style="float:left;margin-left:6px;">
  51.           <a href="/list.php?fid=55">综合新闻</a></div>
  52.         <div class="hot_off" id=tzm4 onmouseover="show_intro('ytld','tzm',4,4,'hot')" style="float:left;margin-left:6px;">
  53.           <a href="/list.php?fid=102">热点新闻</a></div>
  54.       <h3 class="R"></h3>
  55. </tr>
  56.    <tr>
  57.      <td colspan="3" class="middle">
  58.       <div id=ytld1 align="left">$label[a002]</div>
  59.       <div id=ytld2 align="left" style="DISPLAY: none">$label[a003]</div>
  60.       <div id=ytld3 align="left" style="DISPLAY: none">$label[a004]</div>
  61.       <div id=ytld4 align="left" style="DISPLAY: none">$label[a001]</div>
  62. </td>
  63.   </tr>
  64.    <tr>
  65.     <td colspan="3" class="foot">
  66.       <h3 class="L"></h3>
  67.       <h3 class="R"></h3></td>
  68.   </tr>
  69. </table>

  70. /******************************************
  71.   触显代码说明
  72. *******************************************/

  73.     此代码可以在一个网页中设置多个触显。
  74.     设置方法:
  75.     只需要重新命名页面代码中的“ytld”、“tzm”和“4,1”(名称自己定)。
  76.     如:要设一个五显触显:
  77.     只需将“ytld”、“tzm”重新命名,并将“4,1”“4,2”“4,3”“4,4”,
  78. 改为“5,1”“5,2”“5,3”“5,4”“5.5”,就可以了。
  79.     注意其中的“tzm1”“ytld1”也要做相应改变。
复制代码
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-10-22 17:25 , Processed in 0.099887 second(s), 14 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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