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 2 of 2

Thread: Newbie Help!

  1. #1
    New Coder
    Join Date
    Mar 2005
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Newbie Help!

    Write a JavaScript program that checks the system time and then
    based on the following rules: -
    If the time is after 12:00am (midnight) but before 12:00 pm (noon)
    loop to display the numbers from 1 to 10 in a list down the page.
    should be white and the font size 16 point, and the background navy.
    If the time is after 12:00pm (noon) but before 12:00am (midnight)
    display the numbers from 20 to 30 in a list across the page. The digits
    be yellow and the font size 14 point, and the background navy.
    Code:
    h1 { 
    	font-size: 16px;
    	color:#FFFFFF;
    	background-color:#000066
       }
    
    h2 { 
    	font-size: 14px;
    	color: #FFFF00;
    	background-color:#000066
        }
    
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    
    
    <html xmlns="http://www.w3.org/1999/xhtml"
    xml:lang="en" lang="en">
    
    <head>
    <title>Time</title>
    <link rel="stylesheet" href="time.css" type="text/css" />
    </head>
    <body>
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    
    
    <html xmlns="http://www.w3.org/1999/xhtml"
    xml:lang="en" lang="en">
    
    <head>
    <title>Time</title>
    <link rel="stylesheet" href="time.css" type="text/css" />
    <script type="text/JavaScript">
    //<![CDATA[
    var d = new Date()
    while (d.getHours <= "0"   && < "12")
    {
    document.write("<h1>1</h1><br />");
    document.write("<h1>2</h1><br />");
    document.write("<h1>3</h1><br />");
    document.write("<h1>4</h1><br />");
    document.write("<h1>5</h1><br />");
    document.write("<h1>6</h1><br />");
    document.write("<h1>7</h1><br />");
    document.write("<h1>8</h1><br />");
    document.write("<h1>9</h1><br />");
    document.write("<h1>10</h1>");
    }
    
    for ()
    {
    document.write("<h2>20 </h2>");
    document.write("<h2>21 </h2>");
    document.write("<h2>22 </h2>");
    document.write("<h2>23 </h2>");
    document.write("<h2>24 </h2>");
    document.write("<h2>25 </h2>");
    document.write("<h2>26 </h2>");
    document.write("<h2>27 </h2>");
    document.write("<h2>28 </h2>");
    document.write("<h2>29 </h2>");
    document.write("<h2>30 </h2>");
    }
    //]]>
    </script>
    </head>
    <body>
    </body>
    </html>
    </body>
    </html>
    Am i on the right track?

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,920
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    Have a look at the Posting Guidelines and the MUST READ - How To Post A Javascript Question. Then rephrase your query and come back.


  •  

    Posting Permissions

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