my question is this: I have a dynamic countdown script in which I can create a countdown on my webpage by passing a string into a countdown function. I have created a variable that deals with each element of the time i.e. month,day,hour,minute,second.
what I want to do is have a button or hyper-link on my page that when pressed will update the timer i.e. add some extra time to it, such as 9 seconds.
So if I have a:
Expand|Select|Wrap|Line Numbers
- var month = 'April';
- var day = '07';
- var year = '2011';
- var hour = '11';
- var minute = '01';
- var second = '00';
- var test = month+' '+day+', '+year+' '+hour+':'+minute+':'+second;
how do I update this variable by simply clicking on a button or hyper-link.
I have written a basic php script that can do the operation, I just do not know how to implement it cos I am very new with Js.
Expand|Select|Wrap|Line Numbers
- function bid($seconds)
- {
- $seconds = intval($seconds);
- $seconds = $seconds+9;
- if (strlen($seconds)==1)
- {
- $seconds = "'0'+seconds"+'';
- }
- return $seconds;