Javascript倒数脚本 [英] Javascript Countdown script

查看:74
本文介绍了Javascript倒数脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

以下是我用来显示Countdown客户端的Javascript.
它工作正常.但是我需要使用C#后面的asp.net代码对变量进行编程

Hello everyone,

Below is a Javascript i am using to display a Countdown client side.
It works fine. But I need to program the variable from the asp.net code behind in C#

<script language="JavaScript">
    TargetDate = "12/31/2020 5:00 AM";
    BackColor = "palegreen";
    ForeColor = "navy";
    CountActive = true;
    CountStepper = -1;
    LeadingZero = true;
    DisplayFormat = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds.";
    FinishMessage = "It is finally here!";
</script>



当前,我有一个显示目标日期的标签,并且可以正常工作,但是我需要在javascript中获取TargetDate才能将其作为=到标签.
试图从后面的代码中解散代码,但没有运气.



Current I have a label which display the Target Date and that works but I need to get the TargetDate in the javascript to be = to the label.
Tried to fire the code from the code behind but no luck.

<asp:label id="lblDateTime" runat="server" text="" xmlns:asp="#unknown"></asp:label>



有任何想法吗??请帮忙

谢谢


OP更新1:
抱歉,不行..到目前为止,这是我尝试过的



Any Ideas?? Please help

Thanks


UPDATE 1 by OP:
Sorry No Go.. Here is what I have tried so far

<script language="JavaScript">
      //TargetDate = "7/11/2010 5:00 PM";
      //..TargetDate = document.getElementById("<%=hdnStatus.ClientID%>").value;
      TargetDate = .getElementById("lblDateTime").innerText;
      BackColor = "palegreen";
      ForeColor = "navy";
      CountActive = true;
      CountStepper = -1;
      LeadingZero = true;
      DisplayFormat = "%%H%% Hours, %%M%% Minutes, %%S%% Seconds.";
      FinishMessage = "Download Starting";
</script>
Also
<script language="JavaScript">
      //TargetDate = "7/11/2010 5:00 PM";
      //TargetDate = document.getElementById("<%=hdnStatus.ClientID%>").value;
      getElementById("lblDateTime").innerText = TargetDate;
      BackColor = "palegreen";
      ForeColor = "navy";
      CountActive = true;
      CountStepper = -1;
      LeadingZero = true;
      DisplayFormat = "%%H%% Hours, %%M%% Minutes, %%S%% Seconds.";
      FinishMessage = "Download Starting";
</script>


日期在标签中显示良好,因此发生了什么事情


The date dispaly fine in the label so where getting that much to happen

推荐答案

document.getElementById("lblDateTime").innerText = TargetDate;


或使用JQuery


or with JQuery


(''lblDateTime'').val(TargetDate);
(''lblDateTime'').val(TargetDate);


:) :-D :(:-O:rolleyes::rose :: mad :: suss :: cool::-\:doh::((:omg ::rose :: rose :: suss::doh::-O:〜:thumbsdown :: thumbsup :: cool :: rose:X |:suss ::〜:confused::omg​​::mad::rolleyes:: -O:(((:-\:doh::sigh::-\
:) :-D :( :-O :rolleyes: :rose::mad::suss::cool: :-\ :doh: :(( :omg: :rose::rose::suss: :doh: :-O :~:thumbsdown::thumbsup::cool::rose: X| :suss::~:confused: :omg: :mad: :rolleyes: :-O :(( :-\ :doh: :sigh: :-\


这篇关于Javascript倒数脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆