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 to the CF scene
    Join Date
    May 2009
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    dispaying times and dates help

    hi i dont know what is wrong with this code and why it is not working could someone please help me and tell me what i am doing wrong and what i need to do! thankyou

    <html>
    <head><title>Displaying dates and times</title></head>
    <body>
    <h1>Current Date and Time</h1>
    <p>
    <script language="JavaScript">
    localtime= now.toString();
    utctime= now.toGMTString();
    document.write("<b>Local time:</b> " + localtime + "<BR>");
    document.write("<b>UTC time:</b> " + + "</p>");
    hours= now.getHours();
    mins= now.getMinutes();
    document.write("<font size='+5'>");
    document.write(hours+ ":" + mins +":" + secs);
    doucment.write("</font>);
    </script>
    </body>
    </html>

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,310
    Thanks
    203
    Thanked 2,563 Times in 2,541 Posts
    Sounds like homework!

    now is undefined
    secs is undefined
    document.write("<b>UTC time:</b> " + + "</p>"); // work out for yourself what is wrong here
    doucment.write("</font>); spelling and missing closing "

    <script language="JavaScript"> is deprecated and obsolete. Use <script type = "text/javascript"> instead.


    Quizmaster: What was the principal language spoken by the ancient Romans?
    Contestant: Greek

  • #3
    Gütkodierer
    Join Date
    Apr 2009
    Posts
    2,127
    Thanks
    1
    Thanked 426 Times in 424 Posts
    Come on. Either you changed your nick because after starting three threads about that exact same homework assignment code you didn't get the help you expected, or you just happen to take the same course as the other guy and posted at the wrong time in the wrong place.

    Be that as it may, what you are doing is against the rules and you won't get any help here (at least not from me).


  •  

    Posting Permissions

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