agungbudiono
11-01-2016, 12:25 PM
I have a script that serves as a caller for pop up ads. I want to develop this sript so it only works 12 hours a day (or we can set the time). Anyone can help?
<script>
document.addEventListener('DOMContentLoaded', function() {
if(typeof getCookie('popup-schedule-chuan') == 'undefined'){
setCookie('popup-schedule-chuan' , 'true' , 1);
setTimeout(function(){
document.getElementById("xDialog").style.opacity = "1";
} , 5000);
}
});
function setCookie(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
var expires = "expires="+d.toUTCString();
document.cookie = cname + "=" + cvalue + "; " + expires;
}
function getCookie(name) {
var value = "; " + document.cookie;
var parts = value.split("; " + name + "=");
if (parts.length == 2) return parts.pop().split(";").shift();
}
</script>
<script>
document.addEventListener('DOMContentLoaded', function() {
if(typeof getCookie('popup-schedule-chuan') == 'undefined'){
setCookie('popup-schedule-chuan' , 'true' , 1);
setTimeout(function(){
document.getElementById("xDialog").style.opacity = "1";
} , 5000);
}
});
function setCookie(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
var expires = "expires="+d.toUTCString();
document.cookie = cname + "=" + cvalue + "; " + expires;
}
function getCookie(name) {
var value = "; " + document.cookie;
var parts = value.split("; " + name + "=");
if (parts.length == 2) return parts.pop().split(";").shift();
}
</script>