View Single Post
Old 10-23-2012, 07:18 PM   PM User | #1
Mr.
Regular Coder

 
Join Date: Feb 2011
Posts: 112
Thanks: 8
Thanked 4 Times in 4 Posts
Mr. is an unknown quantity at this point
Unhappy Timer plugin won't work after executed once

I am using This Timer Plugin to create a timer once a button is clicked. You can see it in action here If you notice, when you click any of the purchase buttons twice, it is ignored and will not be executed again. I cannot figure out how to correct this. I need to the timer to restart anytime I click the button once the timer is finished.

Here is the the HTML I am using on the first button:

Code:
    <h3 class="protection"><span id="sentryTime">00:00:00</span><a href="javascript:sentry()">Purchase Sentry</a></h3>
And here is the javascript I am using on that button which calls the plugin to create the timer:

Code:
function sentry() {
    	var dateCreated1 = new Date();
    setCharacterTime(/*hr*/0,/*min*/0,/*sec*/5,/*title*/'sentryTime',dateCreated1)} 
    
    
    function setCharacterTime(hours, minutes, seconds, title, creationDate) {
    
    	var thisDay = creationDate;
    	var year = thisDay.getFullYear();
    	var month = thisDay.getMonth();
    	var day = thisDay.getDate();
    	var aHour = thisDay.getHours();
    	var aMinutes = thisDay.getMinutes();
    	var aSeconds = thisDay.getSeconds();
    	var aMilli = thisDay.getMilliseconds();
    	thisDay = new Date(year, month, day, aHour + hours, aMinutes + minutes, aSeconds + seconds, aMilli);
    	$('#' + title).countdown({until: thisDay, format: 'HMS', layout: ' {hnn}{sep}{mnn}{sep}{snn}', expiryText: 'complete '});
    	;} //end setCharacterTime() function
If you need to see the jQuery plugin, you can find it live here.
Mr. is offline   Reply With Quote