<script type="text/javascript">
$(function() {
var newYear = new Date();
newYear = new Date(newYear.getFullYear() + 1, 1 - 1, 1);
$('#countdown').countdown({ until: newYear, format: 'DHMS', layout:
'<div id="timer">' + '<hr />'+
'<div id="timer_days" class="timer_numbers">{dnn}</div>'+
'<div id="timer_hours" class="timer_numbers">{hnn}</div>'+
'<div id="timer_mins" class="timer_numbers">{mnn}</div>'+
'<div id="timer_seconds" class="timer_numbers">{snn}</div>'+
'<div id="timer_labels">'+
'<div id="timer_days_label" class="timer_labels">days</div>'+
'<div id="timer_hours_label" class="timer_labels">hours</div>'+
'<div id="timer_mins_label" class="timer_labels">mins</div>'+
'<div id="timer_seconds_label" class="timer_labels">secs</div>'+
'</div>'+
'</div>'
});
});
</script>
我使用這個腳本來顯示我的網頁上的倒計時......但代替newYear = new Date(newYear.getFullYear() + 1, 1 - 1, 1);
我想從我的數據庫中的新日期...我怎麼能去做??JavaScript的倒計時新的日期
ASPX代碼
<asp:HiddenField runat="server" ID="HF" />
代碼後面[日期是10 \ 21 \ 2011] `
If defaultJob = False Then
sql.SelectCommand.CommandText = "SELECT OfferHeader, OfferDesc, MarketPrice, OfferPrice, Discount, PayInAdv, PayLater, ImageURL, AdTags,EndTime FROM " & offerTable & " WHERE CustID = '" & custID & "' AND BusiID=" & busiID & " AND OfferID=" & offerID
Else
sql.SelectCommand.CommandText = "SELECT OfferHeader, OfferDesc, MarketPrice, OfferPrice, Discount, PayInAdv, PayLater, ImageURL, AdTags,EndTime FROM " & offerTable & " WHERE CustID = '" & custID & "' AND BusiID=" & busiID & " AND OfferID=" & offerID
End If
Try
con.Open()
sql.Fill(table)
con.Close()
With table.Rows(0)
LblOfferHeader.Text = Convert.ToString(.Item(0))
LblOfferDesc.Text = Convert.ToString(.Item(1))
LblMarketPrice.Text = Convert.ToString(.Item(2))
LblOfferPrice.Text = Convert.ToString(.Item(3))
LblDiscount.Text = Convert.ToString(.Item(4))
LblPayInAdv.Text = Convert.ToString(.Item(5))
LblPayLater.Text = Convert.ToString(.Item(6))
ImgOfferImage.ImageUrl = Convert.ToString(.Item(7))
HF.Value = Convert.ToString(.Item(9))
End With
Catch ex As Exception
'MsgBox(ex.Message)
Finally
sql.Dispose()
con.Close()
con.Dispose()
End Try`
從數據庫來的日期是10 \ 21 \ 2011但定時器示出了36分鐘左....爲什麼?我究竟做錯了什麼???
我已經更新了問題,請看看。 –