Click here to Skip to main content
16,016,613 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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>


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>


Any Ideas?? Please help

Thanks


UPDATE 1 by OP:
Sorry No Go.. Here is what I have tried so far
XML
<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
Posted
Updated 11-Jul-10 19:54pm
v3

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

or with JQuery
$('lblDateTime').val(TargetDate);
 
Share this answer
 
:) :-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: :-\
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900