Home > ASP.Net, Javascript > Count Down Timer on Page

Count Down Timer on Page


Hi all,

try this example to create Count Down Timer on Page

1) Open VS 2008 and create a new website and add web page to be like this


<form id="form1" runat="server">
 <div>
 <span>
 <script type="text/javascript" language="JavaScript">
 TargetDate = '<%= AplicationBase() %>';
 NowDate = '<%= NowDate() %>';
 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>
 <script language="JavaScript" src="http://scripts.hashemian.com/js/countdown.js"></script
 </span>
 </div>
</form>

and in code behind add the following code :


protected string AplicationBase()
 {
 DateTime TD = DateTime.Now.AddDays(4);
 return TD.ToString();
 }
 protected string NowDate()
 {
 DateTime ND = DateTime.Now;
 return ND.ToString();
 }

for more information check this link

Hope this helps

Good Luck.

Advertisements
Categories: ASP.Net, Javascript
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: