一个滚动新闻的问题!急!在线等!
我从数据库读取图片和新闻内容,为什么第一次显示的时候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>
代码如下:
<%
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>
...全文


