Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jun 2010
    Posts
    23
    Thanks
    2
    Thanked 0 Times in 0 Posts

    help me to edit a javascript pls.

    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.

    PHP Code:
    <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.getMinutes(),startdate.getSeconds())
    }


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

            
    numberstring = (Math.round(number-0.5) % 10) + numberstring
            number
    number 10
            j
    ++
            if (
    number && j==3) { 
                
    numberstring "," numberstring 
                j
    =0}
            
    i++
         }

         
    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
    ChangeValue
    (totaleschuld,1);


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

    window.onload=maind
    </script>

    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> 

  • #2
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Location
    Arkansas
    Posts
    2,644
    Thanks
    29
    Thanked 330 Times in 326 Posts
    It looks like these lines might need to be changed:
    Code:
    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.
    Last edited by tomws; 06-08-2010 at 10:21 PM.
    Are you a Help Vampire?

  • #3
    New Coder
    Join Date
    Jun 2010
    Posts
    23
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Ok, thank you. It worked. I didnt now what 96,1,1 was but know i know.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •