...

View Full Version : Newbie Help!



TheShadow1
03-21-2005, 05:07 AM
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.



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?

Philip M
03-21-2005, 06:54 AM
Have a look at the Posting Guidelines and the MUST READ - How To Post A Javascript Question. Then rephrase your query and come back.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum