帮我想个办法解决这循环问题吧do....loop

lpbottle 2010-11-08 04:22:12
<input type="hidden" id="remainTimeValue" name="remainTimeValue" value="<%=rs("endTime")%>" />

<script language=javascript>
var remainTimevalue1=document.getElementById("remainTimeValue").value;
function show_time(){
var tmp="2010/10/26 15:00:00";
tmp=tmp.match(/\d+/g);
endTime=new Date(tmp[0],tmp[1]-1,tmp[2], tmp[3],tmp[4],tmp[5]);

var remainTimeValue1=document.getElementById("remainTimeValue").value;

var show=window.setTimeout("show_time()", 1000);
endTime=new Date(remainTimeValue1);
now=new Date();
timeInterval=(endTime.getTime()-now.getTime()); //间隔时间毫秒数
timeIntervalSec=timeInterval/1000
secondsold=Math.floor(timeIntervalSec);
milliSecPerDay=24*60*60*1000 //milliSecPerDay:一天的毫秒数(毫秒:milliseconds

//B_remainDay中B代表Before,意思是Math.floor()之前的剩余天数
B_remainDay=timeInterval/milliSecPerDay;
remainDay=Math.floor(B_remainDay);
B_remainHour=(B_remainDay-remainDay)*24;
remainHour=Math.floor(B_remainHour);
B_remainMinute=(B_remainHour-remainHour)*60;
remainMinute=Math.floor((B_remainHour-remainHour)*60);
seconds=Math.floor((B_remainMinute-remainMinute)*60);
showtime<%=rs("ID")%>.innerHTML=remainDay+"天"+remainHour+"小时"+remainMinute+"分"+seconds+"秒";
if(remainDay<0){
window.clearTimeout(show);
document.getElementById("showtime<%=rs("ID")%>").innerHTML=document.write("正在竞价");
}

}
show_time();
</script>


<%
do while no rs.eof
mainAuctionPic=rs("mainAuctionPic")
if StrLen(rs("auctionName"))<=26 then
auctionName=rs("auctionName")
else
auctionName=StrLeft(rs("auctionName"),24)
end if
auctionSort=rs("auctionSort")
auctionSpec=rs("auctionSpec")
auctionAge=rs("auctionAge")
startPrice=rs("startPrice")
auctionState=rs("auctionState")
endTime=rs("endTime")
response.write "<tr id='jjdt_tr1'>"
response.Write "<td id='jjdt_td1'><img src='"&mainAuctionPic&"' width='60' height='40' style='overflow:hidden;'></td>"
response.Write "<td align='center' width='118'><a href='auctionHall.asp'><font size='2.5' color='black'>"&auctionName&"</font></a></td>"
response.Write "<td id='jjdt_td1'>"&auctionSort&"</td>"
response.Write "<td id='jjdt_td1'>"&auctionSpec&"</td>"
response.Write "<td id='jjdt_td1'>"&auctionAge&"</td>"
response.Write "<td id='jjdt_td1'>"&startPrice&"</td>"
response.Write "<td style='width:70px; height:50px; text-align:center;'>"&auctionState&"</td>"
response.Write "<td style='width:96px; height:50px; text-align:center;'><span id='showtime"&rs("ID")&"'></span></td>"
response.Write "</tr>"
rs.movenext
loop
end if
rs.close
set rs=nothing
end function
%>

我先解释下这段代码:
开头的<input type=hidden......用来获取数据库里endTime值(即将要结束的时间)
中间<script>部分是一段倒计时代码
<%%>部分建立一个表格,数据从数据库里获取

其他部分都没有问题,就是这时间我不知该怎么放,现在只有最后一个数据才会显示时间,其他的都显示空白

这里我知道应该有合适的条件就能让它们都显示出来,这个循环应该怎么写呢???请教各位大虾们!!!
...全文
74 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
lpbottle 2010-11-09
  • 打赏
  • 举报
回复
额,大家批评得是,下回一定注意!
李睿_Lee 2010-11-08
  • 打赏
  • 举报
回复
代码没缩进,看得眼都花了。
  • 打赏
  • 举报
回复
1.先讲清代码作用流程。
2.简化一下代码,剔除无关的。

会的人,想多回几个帖,哪有愿意一上来就看一堆莫名其妙的代码,慢慢看完才知道你想干什么。
你这样,充其量最多是给初学者来看看代码。对你来说,得不到解答。对初学者来说,看有问题的代码本身就不明智。
e_zhiwen 2010-11-08
  • 打赏
  • 举报
回复
莫似,你的VB部分不完整,怎么会多出个end if和end function来?
lpbottle 2010-11-08
  • 打赏
  • 举报
回复
咳!估计是代码太长了,没人愿意看,等了这么久都没一个回复

28,391

社区成员

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

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