Code:
<html>
<!-- saved from url=(0014)about:internet -->
<head>
<title>Count-Up script w/reset and persistent cookie</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<script type="text/javascript">
//Dynamic countup Script- © Dynamic Drive (www.dynamicdrive.com)
//For full source code, 100's more DHTML scripts, and TOS,
//visit http://www.dynamicdrive.com
//Modified here for reset, hrs, mins & secs, and persistent cookie by
//jscheuer1 in http://www.dynamicdrive.com/forums/
//DO NOT put this up live on the web to be used by
//individuals in any type of recovery!!
//For monitored local use ONLY!!
function setcountup(theyear,themonth,theday){
yr=theyear;mo=themonth;da=theday
}
//////////CONFIGURE THE countup SCRIPT HERE//////////////////
//STEP 1: Configure the date to count up from, in the format year, month, day:
//This date should be less than today
setcountup(2005,8,24)
//STEP 2: Configure text to be attached to count up
var displaymessage="have passed since recommitting on "
//STEP 3: Configure the below 5 variables to set the width, height, background color, and text style of the countup area
var countupwidth='95%'
var countupheight='20px' //applicable only in NS4
var countupbgcolor='lightyellow'
var opentags='<font face="Verdana"><small>'
var closetags='</small></font>'
//STEP 4: Configure Number of Years until Cookie Expires
var expYears = 100;
//SET visibility of 'delete cookie' button - 0 for invisible, 1 for visible
delButVis=1
//////////DO NOT EDIT PAST THIS LINE//////////////////
var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
var running, crosscount=''
var r_ate=location.href.indexOf(unescape('%68%74%74%70%3a%2f%2f'))==-1? parseInt(unescape('%31%30%30%30'),10) : ''
function start_countup(){
if (!delButVis){
var delButton=document.all? document.all['delBut'] : document.getElementById('delBut')
delButton.style.display='none'
}
if (document.all||document.getElementById)
crosscount=document.getElementById&&!document.all?document.getElementById("countupie") : countupie
countup()
}
if (document.all||document.getElementById)
document.write('<span id="countupie" style="width:'+countupwidth+'; background-color:'+countupbgcolor+'"></span>')
window.onload=start_countup
function countup(){
var today=new Date()
var todayy=today.getFullYear()
var todaym=today.getMonth()
var todayd=today.getDate()
var todayh=today.getHours()
var todaymin=today.getMinutes()
var todaysec=today.getSeconds()
var todaystring=montharray[todaym]+" "+todayd+", "+todayy+" "+todayh+":"+todaymin+":"+todaysec
paststring=typeof hr!=='undefined'? montharray[mo-1]+" "+da+", "+yr+" "+hr+":"+mn+":"+sc : montharray[mo-1]+" "+da+", "+yr
if(r_ate!=unescape('%31%30%30%30'))
document.write(unescape('%4c%6f%63%61%6c%20%55%73%65%20%4f%6e%6c%79%21%21%21'))
dd=Date.parse(todaystring)-Date.parse(paststring)
dday=Math.floor(dd/(60*60*1000*24)*1)
dhour=Math.floor((dd%(60*60*1000*24))/(60*60*1000)*1)
dmin=Math.floor(((dd%(60*60*1000*24))%(60*60*1000))/(60*1000)*1)
dsec=Math.floor((((dd%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1)
if (document.all||document.getElementById)
crosscount.innerHTML=opentags+(dday<10? '<span style="visibility:hidden;">5</span>'+dday : dday)+ ' days, '+(dhour<10? '<span style="visibility:hidden;">5</span>'+dhour : dhour)+' hours, '+(dmin<10? '<span style="visibility:hidden;">5</span>'+dmin : dmin)+' minutes, and '+(dsec<10? '<span style="visibility:hidden;">5</span>'+dsec : dsec)+' seconds '+displaymessage+mo+'/'+da+'/'+yr+'.'+closetags
running=setTimeout("countup()",r_ate)
}
var exp = new Date();
exp.setTime(exp.getTime() + (expYears*365*24*60*60*1000));
function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
function SetCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
function DeleteCookie (name) {
var exp = new Date();
exp.setTime (exp.getTime() - 1);
var cval = GetCookie (name);
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
var proDate = GetCookie('newDate');
if (proDate != null){
proDate=proDate.split(',');
setcountup(proDate[0],proDate[1],proDate[2])
hr=proDate[3]
mn=proDate[4]
sc=proDate[5]
}
function restart(){
clearTimeout(running)
var reday=new Date()
mo= reday.getMonth()+1
da= reday.getDate()
yr= reday.getFullYear()
hr= reday.getHours()
mn= reday.getMinutes()
sc= reday.getSeconds()
start_countup();
SetCookie('newDate', yr+','+mo+','+da+','+hr+','+mn+','+sc, exp);
}
</script>
<br />
<input type="button" onclick="restart();" value="Recommit" /><br />
<input id="delBut" type="button" onclick="DeleteCookie('newDate');" value="Delete Cookie" />
</body>
</html>
Bookmarks