53 users online (0 members and 53 guests)  


  Results 1 to 3 of 3

Related

  1. how to stop javascript via another javascript    Forum: Javascript Forum
    Replies: 0
  2. Replies: 8
  3. Replies: 5
  4. Javascript / css    Forum: Javascript Forum
    Replies: 1
  5. JavaScript    Forum: Javascript Forum
    Replies: 2
  1. #1
    hzane's Avatar
    New User

    Status
    Offline
    Join Date
    Oct 2003
    Posts
    11

    javascript quandry

    Hi I was hoping someone might look at my code and be able to tell why the month displays as september when it should say october???? Everything else works..... Any ideas?

    function clock() {
    var date = new Date()
    var year = date.getYear()
    var month = date.getMonth()
    var day = date.getDate()
    var hour = date.getHours()
    var minute = date.getMinutes()
    var second = date.getSeconds()
    var months = new Array("", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC")

    var monthname = months[month]

    if (hour > 12) {
    hour = hour - 12
    }

    if (minute < 10) {
    minute = "0" + minute
    }

    if (second < 10) {
    second = "0" + second
    }


    document.title = "it is - " + monthname + " " + day + ", " + year + " - " + hour + ":" + minute + ":" + second

    setTimeout("clock()", 1000)



    much thanks in advance.

  2. #2
    hzane's Avatar
    New User

    Status
    Offline
    Join Date
    Oct 2003
    Posts
    11

    nevermind

    I see it duhh..

  3. #3
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    I'm guessing you cracked the problem in the array?
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?



Tags for this Thread