Help Me Make This Code

Thanks guys for helping, me. the code by sockpuppet seems to be what i want :D, still trying to understand how to edit it thou. but i also got one, which is below

everyone here saying you need php and a database should look at the code from mypmmail and analyze what it's doing...

the javascript code works fine, replace the alert with document.write and you can paste it direct into your html
Code:
<script>
var add = [7, 5, 3, 2, 4, 5];
var cycletotal = 26; // 7+5+3+2+4+5
var time1 = new Date();
var time2 = new Date(2014, 0, 1, 0, 0); // a starting point
var hourdiff = Math.floor((time1-time2) / (1000 * 3600));
var cyclediff = Math.floor(hourdiff / 6); //    $cyclediff =  floor($hourdiff / 6);
var idx = (hourdiff-1) % 6; // $idx = (($hourdiff-1) % 6); // 3600 seconds in hour

var sum = 0;

for (var i = 0; i <= idx; i++) {
        sum = sum + add[i];
}

document.write(28000 + (cyclediff * cycletotal) + sum );
</script>

Now please forgive me for this very noobish question

Is this 2014, 0, 1, 0, 0); YR/MONTH/DAY/?? (HOUR)

var hourdiff = Math.floor((time1-time2) / (1000 * 3600));
var cyclediff = Math.floor(hourdiff / 6); // $cyclediff = floor($hourdiff / 6);
var idx = (hourdiff-1) % 6; // $idx = (($hourdiff-1) % 6); // 3600 seconds in hour

and document.write(28000 + (cyclediff * cycletotal) + sum ); (i am guessing the 28000 is the number which it started from)

Here is the one i managed to set up on my site and it worked, but dont know how to add the 7+5+3+2+4+5 to the code

<div id="counter">
</div>
<script>
var date1 = new Date("10/18/2013");
var date2 = new Date();
var timeDiff = Math.abs(date2.getTime() - date1.getTime());
var diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24));
var totaldownload = diffDays * 2;
totaldownload = totaldownload + 100000;

document.getElementById("counter").innerHTML = "Total Downloads: " + totaldownload;
</script>


Thanks to all of you, and @ mypmmail; i just got a good idea what i can use the javascript for. thanks.
 
Last edited:
Back
Top