天天看点

discuz x2.5 模版制作 滚动图片

1 模版代码:

<!--新星闪耀 start-->
 
   <div style="height:5px;"> </div>
<table width="990" align="center" cellpadding="0" cellspacing="0" style="margin-top:5px; margin:0px auto; margin-bottom:10px;">
  <tbody>
  <tr>
    <td width="20"><img src="template/zao35/images/xgsyx.jpg" width="20" height="100"></td>
    <td width="970" background="http://www.aiao.cn/baohan/images/2_02.jpg">
    <table width="970" border="0" align="center" cellpadding="0" cellspacing="0">
      <tbody>
      <tr>
      <td width="5"> </td>
      <td width="965">
        <div id="demo0" class="subject_navigation0">
        
         <!--[diy=diynewstarlist]--><div id="diynewstarlist" class="area"></div><!--[/diy]-->
           
        </div>
        </td>
        <td width="10"> </td>
      </tr>
    </tbody>
    </table>
    </td>
    
  </tr>
</tbody>
</table>

  <script type="text/javascript">
  var speed1=15 
  document.getElementById("demo02").innerHTML=document.getElementById("demo01").innerHTML
  function Marquee1(){
  if(document.getElementById("demo02").offsetWidth-document.getElementById("demo0").scrollLeft<=0)
  document.getElementById("demo0").scrollLeft-=document.getElementById("demo01").offsetWidth
  else{
  document.getElementById("demo0").scrollLeft++
  }
  }
  var MyMar1=setInterval(Marquee1,speed1)
  document.getElementById("demo0").onmouseover=function () {clearInterval(MyMar1)}
  document.getElementById("demo0").onmouseout=function () {MyMar1=setInterval(Marquee1,speed1)}
 </script>
      
      
 <!--新星闪耀 end-->      

在页面上,diy的时候,“显示样式”设为“自定义模版”。切到模块模版,写入代码:

<table border="0" align="center" cellpadding="0" cellspacing="0" style="OVERFLOW: hidden; " cellspace="0">
              <tbody>
                <tr>
                  <td id="demo01" valign="top"><table width="970" border="0" cellpadding="0" cellspacing="0">
                      <table>
                      <tr> 
                      <td align="center">
                              [loop]
<a href="{url}"{target}><img src="{pic}" width="{picwidth}" height="{picheight}" alt="{title}"  width="68" height="96" border="0"/></a>
    [/loop]
                       </td>
                      </tr>
                 
                  </table>
                  </td>
                  <td id="demo02" valign="top" height="0">
                  <table width="970" border="0" cellpadding="0" cellspacing="0">
                      <tbody>
                          <tr>
                        <td align="center">
                          [loop]
<a href="{url}"{target}><img src="{pic}" width="{picwidth}" height="{picheight}" alt="{title}"  width="68" height="96" border="0"/></a>
    [/loop]
                        </td> 
                      </tr>
                      </tbody>
                  </table>
                  </td>
                </tr>
              </tbody>
            </table>      

到此完成了。