WEB why does my javascript date code work in FF but not IE?

Discussion in 'OT Technology' started by Falconer, May 6, 2009.

  1. Falconer

    Falconer OT Supporter

    Joined:
    Jun 23, 2006
    Messages:
    65,506
    Likes Received:
    1
    The website from which I copied it works in both FF and IE.

    Mine works only in FF. In IE it's blank.

    Code:
     <script>
    
    var mydate=new Date()
    var year=mydate.getYear()
    if (year < 1000)
    year+=1900
    var day=mydate.getDay()
    var month=mydate.getMonth()
    var daym=mydate.getDate()
    if (daym<10)
    daym="0"+daym
    var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
    var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
    document.write(dayarray[day]+", "+montharray[month]+" "+daym+", "+year)
    
    </script>
    thanks
     
  2. fishbulb

    fishbulb Active Member

    Joined:
    Oct 29, 2001
    Messages:
    6,848
    Likes Received:
    4
    Location:
    md
    You testing online as a local file on your computer?
    If its the latter IE may block some JS, need to unblock or put it online to test.
     
  3. Falconer

    Falconer OT Supporter

    Joined:
    Jun 23, 2006
    Messages:
    65,506
    Likes Received:
    1
    yeah i was just testing it locally. Tomorrow I will upload it to my site and test it there and report back here if it still doesn't work.

    Thanks.
     

Share This Page