CMS1.2首页添加滚动图文新闻
作者:cmscn 日期:2005-04-11
打开index2.asp文件
1、将dim voteid改成dim id,topic,voteid
2、增加:
'---------------------------图文新闻开始----------------------------
%>
<table cellspacing=1 cellpadding=3 class=table>
<tr><td class=td0> <script language=javascript>document.write(img_skin("m_help"));</script> <font class=ftd>图文新闻</font></a></td></tr>
<tr class=bg_td><td align=center>
<table border=0 width='100%'>
<tr>
<!------------------新闻图片向上滚动 开始------------------->
<td width='35%'>
<div id=rolllink style=overflow:hidden;height:150;width:190>
<div id=rolllink1>
<table border=0 width='100%'>
<%
sql="select top 10 id,topic,pic from news where hidden=1 and ispic=1 order by id desc"
set rs=joekoe_cms.exec(sql,1)
do while not rs.eof
id=rs("id")
topic=rs("topic")
response.write " <tr><td align=center>"&pic_fk(rs("pic"),2,"news_view.asp?id="&id)&"</td></tr>"
response.write " <tr><td align=center><a href='news_view.asp?id="&id&"' target=_blank alt='"&joekoe_cms.code_html(topic,1,0)&"'>"&joekoe_cms.code_html(topic,1,16)&"</a></td></tr>"
rs.movenext
loop
rs.close
%>
</table>
</div><div id=rolllink2></div></div>
<script language=javascript>
var rollspeed=60
rolllink2.innerHTML=rolllink1.innerHTML //克隆rolllink1为rolllink2
function Marquee(){
if(rolllink2.offsetTop-rolllink.scrollTop<=0) //当滚动至rolllink1与rolllink2交界时
rolllink.scrollTop-=rolllink1.offsetHeight //rolllink跳到最顶端
else{
rolllink.scrollTop++
}
}
var MyMar=setInterval(Marquee,rollspeed) //设置定时器
rolllink.onmouseover=function() {clearInterval(MyMar)}//鼠标移上时清除定时器达到滚动停止的目的
rolllink.onmouseout=function() {MyMar=setInterval(Marquee,rollspeed)}//鼠标移开时重设定时器
</script>
<!------------------ 新闻图片向上滚动 结束------------------->
<td width='65%'>
<table border=0 width='100%'>
<%
sql="select top 7 id,topic,tim,counter from news where hidden=1 and ispic=1 order by id desc"
set rs=joekoe_cms.exec(sql,1)
do while not rs.eof
id=rs("id")
topic=rs("topic")
response.write vbcrlf&"<tr><td height='"&dim_num(6)&"'><img src='skin/"&joekoe_cms.web_skin&"/small/h_news1.gif' border=0 align=absMiddle><a href='news_view.asp?id="&id&"' target=_blank alt='"&joekoe_cms.code_html(topic,1,0)&"'>"&joekoe_cms.code_html(topic,1,26)&"</a><td class=tims align=right>"&joekoe_cms.time_type(rs("tim"),3)&"</td></tr>"
rs.movenext
loop
rs.close
%>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<%
'---------------------------图文新闻结束----------------------------
评论: 7 | 引用: 8 | 查看次数: 573
发表评论