asp 与 javascript 结合的问题,请大家指教一下,摆脱滚动错位的问题,谢谢了.
<table width="465" height="137" border="0" cellpadding="0" cellspacing="0" class="Table3"> <tr>
<td width="463" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="25" bgcolor="b39c1c">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><strong>最新商品</strong></td>
<td>更多</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<div style="overflow:hidden; height:85px" id="icefable1">
<table width="463" height="100" border="0" cellpadding="0" cellspacing="0">
<tr>
<%
sql="select top 12 * from table where len(图片字段)>1 order by id desc"
set rs=conn.execute(sql)
i=1
do while not rs.eof
%>
<td>
<!--循环体开始-->
<table width="100" height="100" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><img src="upfile/<%=rs("图片字段")%>" border="0" height="75" vspace="6" class="Image1" width="100"/></td>
</tr>
<tr>
<td height="15"><%=rs("图片名称")%></td>
</tr>
</table>
<!--循环体结束-->
</td>
<%
if i mod 4 = 0 then
response.Write("<tr>")
end if
i=i+1
rs.movenext:loop
rs.close
set rs=nothing
%>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
<script>//以下是图片循环的脚本,我想让它定时向上滚动每个层上有三张图片横向排列(读取数据库中的内容)但总是在第二遍循环后,就出现了错位的现象
//icefable1就是我想要循环的层的id,其他的不是很懂
marqueesHeight=100;
stopscroll=false;
with(icefable1){
style.width=0;
style.height=marqueesHeight;
style.overflowX="visible";
style.overflowY="hidden";
noWrap=true;
onmouseover=new Function("stopscroll=true");
onmouseout=new Function("stopscroll=false");
}
preTop=0; currentTop=marqueesHeight; stoptime=0;
icefable1.innerHTML+=icefable1.innerHTML;
function init_srolltext(){
icefable1.scrollTop=1;
setInterval("scrollUp()",1);
}init_srolltext();
function scrollUp(){
if(stopscroll==true) return;
currentTop+=1;
if(currentTop==marqueesHeight+3)
{
stoptime+=1;
currentTop-=1;
if(stoptime==500)
{
currentTop=0;
stoptime=0;
}
}
else {
preTop=icefable1.scrollTop;
icefable1.scrollTop+=1;
if(preTop==icefable1.scrollTop){
icefable1.scrollTop=marqueesHeight;
icefable1.scrollTop+=1;
}
}
}
init_srolltext();
</script>