View Full Version : help me to edit a javascript pls.

06-08-2010, 09:12 PM
I want to edit the code below so i can use it for my country. I only dont know which things i have to change, except the ``var now``. Can someone pls help me by explaining which things i have to change .. If u have more questions pls ask me.

<script type="text/javascript">

* World Populution Counter - By JavaScript Kit (http://www.javascriptkit.com)
* Based on code by Adam Brown
* This notice MUST stay intact for use
* Visit JavaScript Kit (http://www.javascriptkit.com) for this script and more

function maind(){
startdate = new Date()
now(startdate.getYear(),startdate.getMonth(),startdate.getDate(),startdate.getHours(),startdate.getM inutes(),startdate.getSeconds())

function ChangeValue(number,pv){
numberstring =""
var j=0
var i=0
while (number > 1)

numberstring = (Math.round(number-0.5) % 10) + numberstring
number= number / 10
if (number > 1 && j==3) {
numberstring = "," + numberstring


if (pv==1) {document.getElementById("worldpop").innerHTML=numberstring }

function now(year,month,date,hours,minutes,seconds){
startdatum = new Date(year,month,date,hours,minutes,seconds)

var now = 5600000000.0
var now2 = 5690000000.0
var groeipercentage = (now2 - now) / now *100
var groeiperseconde = (now * (groeipercentage/100))/365.0/24.0/60.0/60.0
nu = new Date ()
schuldstartdatum = new Date (96,1,1)
secondenoppagina = (nu.getTime() - startdatum.getTime())/1000
totaleschuld= (nu.getTime() - schuldstartdatum.getTime())/1000*groeiperseconde + now

timerID = setTimeout("now(startdatum.getYear(),startdatum.getMonth(),startdatum.getDate(),startdatum.getHours(),startdatum .getMinutes(),startdatum.getSeconds())",200)


Current world population (estimated): <span id="worldpop" style="font-weight: bold"></span>.

<p style="font: normal 11px Arial">This free script provided by<br />
<a href="http://www.javascriptkit.com">JavaScript Kit</a></p>

06-08-2010, 10:19 PM
It looks like these lines might need to be changed:

var now = 5600000000.0
var now2 = 5690000000.0
/* ... */
schuldstartdatum = new Date (96,1,1)

schuldstartdatum seems to be the base date - in this case 1996-01-01. now is probably the population as of the base date. I don't know if now2 is a real number or if it's just forced so the the next line (to get the percent change) can be a certain number.

EDIT: Looking at the per second line, I'm betting now2 is now plus the expected population change over a year.

06-09-2010, 02:13 PM
Ok, thank you. It worked. I didnt now what 96,1,1 was but know i know.