Results 1 to 5 of 5
  1. #1
    yellow_jacket is offline Member
    Join Date
    Apr 2011
    Posts
    2
    Rep Power
    0

    Default java help please

    Could someone please help me with this.

    I have a script that calculates world population growth which works fine, if i add another script for Canada population growth it doesnt show and only displays the World pop. growth. please probably an easy fix for all you experts. any help is much appreciated.

    Thanks!


    <script type="text/javascript">


    function maind(){
    startdate = new Date()
    now(startdate.getYear(),startdate.getMonth(),start date.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
    j++
    if (number > 1 && j==3) {
    numberstring = "," + numberstring
    j=0}
    i++
    }

    numberstring=numberstring

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


    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.ge tMonth(),startdatum.getDate(),startdatum.getHours( ),startdatum.getMinutes(),startdatum.getSeconds()) ",200)
    }

    window.onload=maind
    </script>

    World population: <span id="worldpop" style="font-weight: bold"></span></align>

    <br>

    <script type="text/javascript">

    function maind(){
    startdate = new Date()
    now(startdate.getYear(),startdate.getMonth(),start date.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
    j++
    if (number > 1 && j==3) {
    numberstring = "," + numberstring
    j=0}
    i++
    }

    numberstring=numberstring

    if (pv==1) {document.getElementById("canpop").innerHTML=numbe rstring }
    }


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

    var now2 = 34573385.0
    var now4 = 34884545.0
    var groeipercentage = (now4 - now2) / now2 *100
    var groeiperseconde = (now2 * (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 + now2
    ChangeValue(totaleschuld,1);


    timerID = setTimeout("now2(startdatum.getYear(),startdatum.g etMonth(),startdatum.getDate(),startdatum.getHours (),startdatum.getMinutes(),startdatum.getSeconds() )",200)
    }

    window.onload=maind
    </script>
    Canada population: <span id="canpop" style="font-weight: bold"></span>

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,585
    Rep Power
    12

    Default

    Wrong language! This is a Java forum, you posted some JavaScript.

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    Your question is not a Java question but a JavaScript question, and these two programming languages are about as similar as ham is to hamster. I recommend that you Google for a JavaScript forum and ask this question there. Luck.

  4. #4
    yellow_jacket is offline Member
    Join Date
    Apr 2011
    Posts
    2
    Rep Power
    0

    Default

    lol thanks experts.

  5. #5
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

Posting Permissions

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