一个滚动新闻的问题!急!在线等!

zjfeel99 2006-07-17 10:03:00
我从数据库读取图片和新闻内容,为什么第一次显示的时候3条新闻的内容重叠,求助!
代码如下:

<%
dim rs9,sql9
set rs9 =server.CreateObject("adodb.recordset")
sql9="select top 3 D_id, D_title, D_content from NewsData where D_pic=1 and D_ding='yes' order by D_id desc"
rs9.open sql9,conn,1,1
function Remove_HTML(str)
dim ilen1,ilen2
do while instr(1,str,"<",1) >0
ilen1=instr(1,str,"<",1)
ilen2=instr(1,str,">",1)
str=left(str,ilen1 -1)&mid(str,ilen2+1)
loop

Remove_HTML = str
end function
%>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(pars9eInt(appVers9ion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
<style>
div{
FILTER:revealTrans(transition=4,duration=2);
}
.style80 {
font-size: 12px;
color: #669933;
}
</style>
<body onLoad="p()">
<%for pi = 1 to 3
%>
<div id="jx<%=pi%>" style="position:absolute; width:449; height:141px; z-index:1; left: 301px; top: 217px;">
<table width="449" height="143" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="156">
<table width="100" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><%
if rs9.recordcount = 0 then
Img_str="<IMG width='140' height='120' border=0 src='images/nophoto.gif'>"
else
Dim Img, Img1, Img_str, Img_C, ih',ih1,ih2
Dim news_subject, news_id
news_subject=rs9("D_title")
news_id=rs9("D_id")
Img=replace(rs9("D_Content"),"onload=""javascript:if(this.width>600)this.width=600""","")
ih = left(replace(replace(rs9("D_Content"),"this.width>","")," ",""),50)
Img1=split(Img,"<IMG")
Img_C=Instr(1,Img1(1),">",1)
Img_str="<IMG width='140' height='101' " & left(Img1(1),Img_C)
end if
%>
<a href="view_news.asp?D_id=<%=rs9("D_id")%>" target="_blank" title="<%=rs9("D_title")%>">
<%response.Write(Img_str)%>
</a></td>
</tr>
</table></td>
<td width="293"><div align="left"></div>
<table width="81%" height="23" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td> <a href="view_news.asp?D_id=<%=rs9("D_id")%>" title="<%=rs9("D_title")%>" target="_blank" class="style1">
<%
dim nr
nr = Remove_HTML(rs9("D_content"))
response.Write(left(nr,60)&"...")
%>
</a></td>
</tr>
</table></td>
</tr>
</table>
</div> <%rs9.movenext
next
rs9.close
%>
<SCRIPT>
var jx1=document.getElementById("jx1");var jx2=document.getElementById("jx2");var jx3=document.getElementById("jx3");
//设置显示哪个层的变量
var sL=1;
//设置动与不动的变量
var iS=0;
//设定显示时间
function p()
{

if(iS==0)
{
if(sL==1)
{
cs1(jx1,1);
cs1(jx2,0);
cs1(jx3,0);
setTimeout('p()',7000);
}
else if(sL==2){
cs1(jx1,0);
cs1(jx2,1);
cs1(jx3,0);
setTimeout('p()',7000);
}
else{

cs1(jx1,0);
cs1(jx2,0);
cs1(jx3,1);
setTimeout('p()',7000);
}
sL++;
if(sL==4) sL=1;
}
else
{
setTimeout('p()',2000);
}

}
//显示函数
function cs1(a,b)
{if(a==null)return;
a.filters.revealTrans.apply();
if(b==1) a.style.visibility="visible";
else a.style.visibility="hidden";
a.filters.revealTrans.play();}
//设定is变量
function s(v)
{iS=v;}
</SCRIPT>
...全文
169 4 打赏 收藏 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
跑路的蛤蟆 2006-07-18
  • 打赏
  • 举报
回复
唉自己看吧肯定是javascript的事
zjfeel99 2006-07-17
  • 打赏
  • 举报
回复
没有错误提示啊,运行也是能运行的,可是刚开始的时候3层重叠的,然后就好了,求救啊
wangliang19831117 2006-07-17
  • 打赏
  • 举报
回复
网页左下角应该有提示的。
kkk3279 2006-07-17
  • 打赏
  • 举报
回复
很明显,重叠是因为你的SCRIPT没有正确执行,而他们的DIV的位置又是一样的....

我没办法检查出脚本的错误,把出错的信息贴出来看看吧...网页左下角应该有提示吧..

28,402

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧