新闻标题滚动已实现,但左边没对齐,高手指点下,不胜感激!!!
源码:<style>
<!--
#ScrollBox{width:320px;height:120px;font-size:14px;line-height:20px;overflow:hidden;border:0px solid #ccc}
#ScrollBox ul{margin:0;padding:0;list-style:none}
-->
</style>
<%
function cutstr(tempstr,tempwid)
if len(tempstr)>tempwid then
cutstr=left(tempstr,tempwid)&"..."
else
cutstr=tempstr
end if
end function%>
<div id="ScrollBox">
<ul id="ScrollHolder">
<table width="95%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2">
<%
set rs_news=server.createobject("adodb.recordset")
sqltext4="select top 5 * from news where BigClassName='行业科技' order by AddDate desc "
rs_news.open sqltext4,conn,1,1
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<%i=0
do while not rs_news.eof
strr=year(rs_news("AddDate"))&"-"&month(rs_news("AddDate"))&"-"&day(rs_news("AddDate"))%>
<tr align="center">
<td width="28" align="left" style='BORDER-bottom: #C2C2C2 1px dashed'><img src="images/newdot.jpg" width="4" height="7" /></td>
<td style='BORDER-bottom: #C2C2C2 1px dashed' width="747" height="25" align="left" ><a class="txt" href="shownew.asp?id=<%=rs_news("id")%>&title=媒体报道" target="_blank">
<%=cutstr(rs_news("title"),15)%></a> </td>
<td style='BORDER-bottom: #C2C2C2 1px dashed' width="224" align="right" ><a class="txt" href="shownew.asp?id=<%=rs_news("id")%>&title=媒体报道媒体报道" target="_blank">[<%=strr%>]</a></td>
</tr>
<%rs_news.movenext
i=i+1
loop
rs_news.close %>
</table></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</ul>
</div>
<script type="text/javascript">
var marquee = {
init:function(speed){
this.ScrollBox = document.getElementById("ScrollBox");
this.ScrollHolder = document.getElementById("ScrollHolder");
this.speed = speed;
this.pause = false;
this.clientH = this.ScrollBox.clientHeight;
this.ScrollBox.onmouseover = function(){marquee.pause = true;};
this.ScrollBox.onmouseout = function(){marquee.pause = false;};
this.ScrollHolder.innerHTML += this.ScrollHolder.innerHTML;
setInterval(this.scrolling,this.speed);
},
scrolling:function(){
if(marquee.pause) return;
marquee.ScrollBox.scrollTop += 1;
if(marquee.ScrollBox.scrollTop >= marquee.ScrollHolder.offsetHeight/2){
marquee.ScrollBox.scrollTop = 0;
}
}
}
marquee.init(30);
</script>
显示如下图: