帮我想个办法解决这循环问题吧do....loop
<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>部分是一段倒计时代码
<%%>部分建立一个表格,数据从数据库里获取
其他部分都没有问题,就是这时间我不知该怎么放,现在只有最后一个数据才会显示时间,其他的都显示空白
这里我知道应该有合适的条件就能让它们都显示出来,这个循环应该怎么写呢???请教各位大虾们!!!