当前位置:编程学习 > C#/ASP.NET >>

关于在Repeater中倒计时问题

 Repeater 中有多个倒计时功能,,  但是只有第一个可以出来,,剩下的都 没有效果。。。  请各位给看看什么原因、



<asp:Repeater ID="rptitemlist" runat="server">
                    <ItemTemplate>
                        <div style="width: 690px; border: solid 2px #EE9270; height: 430px; margin-top:5px;">
                            <div style="font-size: 36px; background-color: #F0F0F0; font-weight: 600; width: 680px;
                                margin: auto; padding: auto;">
                                <div>
                                    <%#Container.ItemIndex+1 %>
                                </div>
                            </div>
                            <div style="width: 660px; margin: auto; padding: auto; font-size: 22px; padding: 5px;
                                font-weight: 900;">
                                <span style="color: #FF4E00;">今日团购:</span> <span><a href='tuan-info.aspx?ID=<%# Eval("CourseID")%>'>
                                    <%# Eval("ActCourseName")%></a> </span>
                            </div>
                            <div style="width: 694px;">
                                <div style="float: left; width: 232px;">
                                    <div style="background-image: url('images/tuangou.gif'); background-repeat: repeat-x;
                                        width: 232px; height: 75px;">
                                        <table style="margin: auto; padding: auto; height: 75px; width: 232px; overflow: hidden;">
                                            <tr>
                                                <td style="text-align: center0; width: 110px; overflow: hidden; vertical-align: middle;
                                                    font-size: 25px; font-weight: 900; color: White;">
                                                    ¥<%# Eval("ActPrice", "{0:N0}")%>
                                                </td>
                                                <td style="vertical-align: middle;">
                                                    <a alt="购买" class="" target="_blank" href="courseInfo.aspx?ID=<%#Eval("ID")%>">
                                                        <img alt="" title="购买" src="images/gm.gif" /></a>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                    <div style="height: 75px;">
                                        <table class="deal-discount" style="float: right;">
                                            <tr>
                                                <th>
                                                    原价
                                                </th>
                                                <th>
                                                    折扣
                                                </th>
                                                <th>
                                                    节省
                                                </th>
                                            </tr>
                                            <tr>
                                                <td>
                                                    ¥<%# Eval("OriginalPrice", "{0:N0}") %>
                                                </td>
                                                <td>
                                                    <%# GetCount(Eval("ActPrice"), Eval("OriginalPrice"))%>折
                                                </td>
                                                <td>
                                                    ¥<%# GetReta(Eval("ActPrice"), Eval("OriginalPrice"))%>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                    <div class="deal-box" style="float: right;">
                                        <div class="d_open fr">
                                            <img src="images/bg-deal-open.gif" height="60px" /></div>
                                        <h3>
                                            剩余时间</h3>
                                        <div class="limitdate">

                                            <asp:HiddenField ID="HiddenField1" runat="server" Value='<%#Eval("EndDateTime") %>' />
                                            
                                            <div id="show_time"></div>
                                            <asp:Panel ID="Panel1" runat="server">
                                            </asp:Panel>
                                        </div>
                                    </div>
                                    <div class="deal-box deal-status deal-status-open" id="deal-status" style="float: right;">
                                        <!-- 团购起团人数 -->
                                        <div>
                                            <%# GetCourseTime(Eval("CourseID"), Eval("MinCount"), Eval("MaxCount"))%>
                                        </div>
                                        <%--<p class="deal-buy-tip-top">
                                            <strong>37</strong> 人已购买</p>
                                        <p class="deal-buy-on" style="line-height: 200%;">
                                            <img src="images/deal-buy-succ.gif" />
                                            团购成功!
                                            <br />
                                            还可以继续购买</p>
                                        <p class="deal-buy-tip-btm">
                                            8点58分达到最低团购人数:<strong>5</strong>人</p>--%>
                                    </div>
                                </div>
                                <div style="width: 440px; height: 350px; float: left; margin-left: 10px;">
                                    <div style="width: 435px; overflow: hidden; height: 230px;">
                                        <a href='tuan-info.aspx?ID=<%# Eval("CourseID")%>'>
                                            <asp:Image ID="ImgCoursePic" runat="server" ImageUrl='<%#Eval("ActPic")%>' Width="435px"
                                                Height="230px" /></a>
                                    </div>
                                    <div style="height: 20px; line-height: 20px; width: 435px;">
                                        上课地址:<%#Eval("Address")%>
                                    </div>
                                    <div style="width: 435px; overflow: hidden; height: 100px; margin-top: 5px;">
                                        <table style="width: 435px; overflow: hidden; height: 130px; color: #5C5C5C; line-height: 18px;">
                                            <tr>
                                                <td rowspan="2" style="width: 77px; vertical-align: top;">
                                                    <img src="images/douhao.jpg" />
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style="vertical-align: top; text-align: left; padding-top: 30px;">
                                                    <%#Eval("Tip")%>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </ItemTemplate>
                </asp:Repeater>



function count_down() {
             var a = document.getElementById("ctl00_ContentPlaceHolder1_rptitemlist_ctl00_HiddenField1").value;
             testDay = new Date(a);
             today = new Date();

             time = (testDay.getTime() - today.getTime()) / (24 * 60 * 60 * 1000);
             day = Math.floor(time);
             time = (time - day) * 24;
             hour = Math.floor(time);
             time = (time - hour) * 60;
             minute = Math.floor(time);
             time = (time - minute) * 60;
             second = Math.floor(time);
             document.getElementById("ctl00_ContentPlaceHolder1_rptitemlist_ctl00_Panel1").innerHTML = day + "天" + hour + "小时" + minute + "分" + second + "秒";
         }
         setInterval("count_down()", 1000);

非常纠结~~~~
--------------------编程问答-------------------- 怎么没回答啊。。。在线等啊!! --------------------编程问答--------------------   大虾们,,块来啊!! --------------------编程问答-------------------- 路过 帮你顶下 代码太多了看着头晕 --------------------编程问答--------------------  var a = document.getElementById("ctl00_ContentPlaceHolder1_rptitemlist_ctl00_HiddenField1").value;
这样用法可能会有问题。
另外没看到你在repeater中调用这个JS 方法的地方
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,