Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,154,146 members, 7,821,908 topics. Date: Wednesday, 08 May 2024 at 09:26 PM

I Need Help Adding Count Down To This - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / I Need Help Adding Count Down To This (1028 Views)

Programming Challenge: Adding Time 12h:59m + 20h:53 In Your Programming Language / I Need A Help Adding Billing Information On GCP And Azure. / I Need Help Adding Some Code On My Laravel Project And I Will Pay. (2) (3) (4)

(1) (Reply) (Go Down)

I Need Help Adding Count Down To This by skyhighweb(m): 5:08pm On Jan 16, 2018
<style type='text/css'> /* Lets use a Google Web Font smiley */
input[disabled] {
background-color:#FF6347;
}

</style>

<input type="button" id="submit" value="submit" class="btn" />
<script type="text/javascript">

$(function(){
Program.Init();
});

var Program = {

Init: function(){
this.$target = $('#submit').attr("disabled", true);
this.EnableSubmit();
this.EventHandler();
},

EnableSubmit: function(){
var value = this.Cookies.Get('submit_button');
var now = Date.now();
if( !value ) {
this.$target.removeAttr("disabled"wink;
return;
}
setTimeout(function() { Program.EnableSubmit(); }, value - now);
},

Submit: function(){
this.$target.attr("disabled", true);
this.Cookies.Set('submit_button', Date.now() + 8000, 0.25, { expire_in: 'minutes' });
setTimeout(function() { Program.EnableSubmit(); }, 8000);
},

EventHandler: function(){
this.$target.on('click', function(){ Program.Submit(); });
},

// methods to manage cookies easily used above
Cookies: {

Get: function (name) {
var n, ca, c;
n = name + "=";
ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
c = ca[i].trim();
if (c.indexOf(name) === 0) return c.substring(name.length + 1, c.length);
}
return false;
},

Set: function (name, value, expire, options) {
var d = new Date(), expires;
var defaults = { expire_in: 'days', path: '/' };
if (options !== undefined) $.extend(true, defaults, options);
if (expire !== undefined && expire !== null) {
if (defaults.expire_in == 'days') d.setDate(d.getDate() + expire);
else if (defaults.expire_in == 'minutes') d.setTime(d.getTime() + (expire * 60 * 1000));
else {
console.log('expire_in configuration is not valid');
}
expires = "expires=" + d.toGMTString();
}
else expires = expires = "";
document.cookie = name + "=" + value + "; " + expires + '; path=' + defaults.path;
return true;
}

}

};

</script>






thank you
Re: I Need Help Adding Count Down To This by nnamdiosu(m): 10:54pm On Jan 19, 2018
Bro...its difficult to read code on a web page like this. Therefore simply state the problem you are having to make it easier to help you...or better still what u want to do so we can help you straight away.
Peace
Re: I Need Help Adding Count Down To This by webdeveloperqx: 11:29am On Jan 20, 2018
skyhighweb:
<style type='text/css'> /* Lets use a Google Web Font smiley */
input[disabled] {
background-color:#FF6347;
}

</style>

<input type="button" id="submit" value="submit" class="btn" />
<script type="text/javascript">

$(function(){
Program.Init();
});

var Program = {

Init: function(){
this.$target = $('#submit').attr("disabled", true);
this.EnableSubmit();
this.EventHandler();
},

EnableSubmit: function(){
var value = this.Cookies.Get('submit_button');
var now = Date.now();
if( !value ) {
this.$target.removeAttr("disabled"wink;
return;
}
setTimeout(function() { Program.EnableSubmit(); }, value - now);
},

Submit: function(){
this.$target.attr("disabled", true);
this.Cookies.Set('submit_button', Date.now() + 8000, 0.25, { expire_in: 'minutes' });
setTimeout(function() { Program.EnableSubmit(); }, 8000);
},

EventHandler: function(){
this.$target.on('click', function(){ Program.Submit(); });
},

// methods to manage cookies easily used above
Cookies: {

Get: function (name) {
var n, ca, c;
n = name + "=";
ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
c = ca[i].trim();
if (c.indexOf(name) === 0) return c.substring(name.length + 1, c.length);
}
return false;
},

Set: function (name, value, expire, options) {
var d = new Date(), expires;
var defaults = { expire_in: 'days', path: '/' };
if (options !== undefined) $.extend(true, defaults, options);
if (expire !== undefined && expire !== null) {
if (defaults.expire_in == 'days') d.setDate(d.getDate() + expire);
else if (defaults.expire_in == 'minutes') d.setTime(d.getTime() + (expire * 60 * 1000));
else {
console.log('expire_in configuration is not valid');
}
expires = "expires=" + d.toGMTString();
}
else expires = expires = "";
document.cookie = name + "=" + value + "; " + expires + '; path=' + defaults.path;
return true;
}

}

};

</script>






thank you

put your code on codepen.io
and share the link , a well formatted code with linting will always receive help from those who can help than what you just posted here in plain .
Re: I Need Help Adding Count Down To This by skyhighweb(m): 11:47am On Jan 20, 2018
okay
Re: I Need Help Adding Count Down To This by skyhighweb(m): 1:19pm On Jan 20, 2018

(1) (Reply)

Programmers / Contact Me For Your Android Project / Top Best Home Design App For Android In 2018

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 21
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.