Hi all,
i need the count down timer when button click the timer start and count down work on ASP.net
:(
i have one timer which is on JavaScript that run page onload . but i need the Button click my code is here...
<%@ Page Language="C#" AutoEventWireup ="true" CodeFile="Defau lt.aspx.cs" Inherits="_Defa ult" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>timer</title>
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaS cript">
<!--
dateFuture = new Date(2007,10,12 ,18,43,48);
//nothing beyond this point
function GetCount(){
dateNow = new Date(); //grab current date
amount = dateFuture.getT ime() - dateNow.getTime (); //calc milliseconds between dates
delete dateNow;
// time is already past
if(amount < 0){
document.getEle mentById('count box').innerHTML ="Now!";
}
// date is still good
else{
days=0;hours=0; mins=0;secs=0;o ut="";
amount = Math.floor(amou nt/1000);//kill the "millisecon ds" so just secs
days=Math.floor (amount/86400);//days
amount=amount%8 6400;
hours=Math.floo r(amount/3600);//hours
amount=amount%3 600;
mins=Math.floor (amount/60);//minutes
amount=amount%6 0;
secs=Math.floor (amount);//seconds
if(days != 0){out += days +" day"+((days!=1) ?"s":"")+", ";}
if(days != 0 || hours != 0){out += hours +" "+((hours!=1)?" :":"")+" ";}
if(days != 0 || hours != 0 || mins != 0){out += mins +" "+((mins!=1 )?" ":"")+", ";}
out += secs +" seconds";
document.getEle mentById('count box').innerHTML =out;
setTimeout("Get Count()", 1000);
}
}
//window.onload=f unction(){GetCo unt();}//call when everything has loaded
//-->
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="countbox" ></div>
<asp:Button ID="Button1" runat="server" Text="Start " OnClick="Button 1_Click"/>
</body>
</html>
this is my code.
please friends Help me
3 6148
Have you tried AJAX .Net components for this?
you can get more info on this as ajax.asp.net
cheers
Have you tried AJAX .Net components for this?
you can get more info on this as ajax.asp.net
cheers
i can not use Ajax. on my online server where i upload my site there is no accessible for Ajax dll files
This is a client side JS problem, its incidental that you are using asp.net. Normally this type of function called in onload event declared on the body tag. HTH.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Noozer |
last post by:
I have a timer on a form. It isn't firing at all. I know that the timer is
enabled, and that the interval is low (4000, which should be 4 seconds). To
ensure the timer wasn't being inadvertantly reset I put some extra code in
the subs that enable and disable the timer. They fire as expected.
To test this I added a second timer with a 1 second interval. The event for
this time would output the enabled status of the first timer and its...
|
by: HeroinNO.4 |
last post by:
Copy the code below and save in a .htm file, for example : 1.htm, then
run it in browser, you'll see a cool count down timer ! If it doesn't
work, you may open http://www.fillweb.com in IE and View->Source, and
the latest version of count down timer will show you !
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
|
by: HeroinNO.4 |
last post by:
Hello guys, sorry for my last version has a little "feature"(MS always
call his bug "feature"), and now I fixed it and show the source to you
all ! Just as the last version, copy the code below and save in a .htm
file, fox example : "1.htm", and run it in a browser support JavaScript
1.1 or later, the cool count down timer will show you ! If it doesn't
work, you may open http://www.fillweb.com in IE, and View->Source to
see the latest...
|
by: HeroinNO.4 |
last post by:
Hello guys, now the source code updated to November 06, 2006 00:00
GMT,and now I fixed it and show the source to you all ! Just as the
last version, copy the code below and save in a .htm file, fox example
: "1.htm", and run it in a browser support JavaScript 1.1 or later, the
cool count down timer will show you ! If it doesn't work, you may open
http://www.fillweb.com in IE, and View->Source to see the latest
version of source code !
|
by: HeroinNO.4 |
last post by:
You can open http://www.fillweb.com in IE and View->Source to see the
latest version full featured count down timer source code, or you may
also copy the code below and save in a "*.htm" file, for example
"countdown.htm", and open it in browser, you'll see the full featured
count down timer !
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html;
| |
by: HeroinNO.4 |
last post by:
Hello everyone! Now the latest version of free count down timer source
code is available in http://www.fillweb.com/countdown.htm, you can open
it in IE and View->Source to see the latest version source code, also
you may copy the code below and save in a ".htm" file, and run it in
browser, a cool count down timer will show you !
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type"...
|
by: HeroinNO.4 |
last post by:
Hello guys, free count down timer source code has updated to 06/11/27,
you can copy the code below and save in a ".htm" file and run it in a
browser support javascript 1.1 or later, or you can open
http:\\www.fillweb.com\countdown.htm, if you are using IE, you may
View->Source to see the latest version of source code !
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
|
by: Amit Dedhia |
last post by:
Hi
I am developing a scientific application which has moderate level
image processing involved.
In my application, there is a main application form which invokes
another form. When this form is running, a timer function keeps
executing every 250ms. The timer function does some real time data
processing and generates a bitmap which needs to be displayed on a
picture control. This is done using this->Invoke(...) in the form.
|
by: canabatz |
last post by:
Hi all!
i got a countdown timer for auctions that runing.
i got a DIV that refreshs every 4 seconds
that DIV is refreshed by ajax ,the file that is refreshed is timer.php for example!!
my problem is that the timer.php is not showing up.
if i run the timer.php alone it is showing the timer ,the problem i think it's because the timer sits inside the ajax DIV and that is what i think making me the problem!!
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |