代码片段:
<div id="demo" style="OVERFLOW: hidden; WIDTH: 100%; COLOR: #ffffff">
<table width="120" cellspacing="0" cellpadding="0" align="center" border="0" cellspace="0">
<tbody>
<tr>
<td id="demo1" valign="top">
<table width="110">
<tr>{dede:sql sql="Select bid,bookname,author,pubdate,body,litpic From dede_story_books order by bid desc limit 0,8"}
<td align="center"><a href="/book/book.php?bid=[field:bid/]" target="_blank"><img src="[field:litpic/]" alt="[field:bookname/]" border="0"/ width="115" height="130"></a>
<li><a><strong>作 者:</strong>[field:author /]</a></li>
<li><a href="/book/book.php?bid=[field:bid/]" target="_blank">[field:bookname/]</a></li> </td>
{/dede:sql}
</tr>
</table>
</td>
<td width="0" valign="top" id="demo2"></td>
</tr>
</tbody>
</table>
</div>
<script>
var speed3=30//速度数值越大速度越慢
demo2.innerHTML=demo1.innerHTML
function Marquee(){
if(demo2.offsetWidth-demo.scrollLeft<=0)
demo.scrollLeft-=demo1.offsetWidth
else{
demo.scrollLeft++
}
}
var MyMar=setInterval(Marquee,speed3)
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed3)}
</script>
以上代码可以直接插入到首页需要安放小说模块调用的地方,我的站将这部分安放在“图文资讯”栏目下方了。完整代码是在“图文资讯”下方插入
代码片段:
<div class="picnews">
<dl class="tbox light">
<dt class='light'><strong>图书连载</strong></dt>
<dd class='light'>
<div id="demo" style="OVERFLOW: hidden; WIDTH: 100%; COLOR: #ffffff">
<table width="120" cellspacing="0" cellpadding="0" align="center" border="0" cellspace="0">
<tbody>
<tr>
<td id="demo1" valign="top">
<table width="110">
<tr>{dede:sql sql="Select bid,bookname,author,pubdate,body,litpic From dede_story_books order by bid desc limit 0,8"}
<td align="center"><a href="/book/book.php?bid=[field:bid/]" target="_blank"><img src="[field:litpic/]" alt="[field:bookname/]" border="0"/ width="115" height="130"></a>
<li><a><strong>作 者:</strong>[field:author /]</a></li>
<li><a href="/book/book.php?bid=[field:bid/]" target="_blank">[field:bookname/]</a></li> </td>
{/dede:sql}
</tr>
</table>
</td>
<td width="0" valign="top" id="demo2"></td>
</tr>
</tbody>
</table>
</div>
<script>
var speed3=30//速度数值越大速度越慢
demo2.innerHTML=demo1.innerHTML
function Marquee(){
if(demo2.offsetWidth-demo.scrollLeft<=0)
demo.scrollLeft-=demo1.offsetWidth
else{
demo.scrollLeft++
}
}
var MyMar=setInterval(Marquee,speed3)
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed3)}
</script>
</dd>
</dl>
</div>
提示:当然大家可以根据自己站的特点,修改相关代码。
(责任编辑:最模板) |