eidalina20
04-16-2007, 12:53 AM
Hello everyone!
i really need help with this... i am stuck.. i know i am close but can't see it.
What i have to do is get seconds from the date listed.
time always changes therefore, seconds change
what i have problem with is changing the color of the "bluh" word. It should change each first number of the second. Meaning 10-19 one color 20-29 another color 30-39 another and so on.
it looks simple:
Mon Apr 16 01:41:10 EDT 2007
10
0
1 <-- color should change based on this numer
orange
blah
here is my code:
<html>
<head>
<script language=“JavaScript” type="text/javascript">
<!--
var colo= new Array(11)
colo[0]="red";
colo[1]="orange";
colo[2]="green";
colo[3]="blue";
colo[4]="brown";
colo[5]="yellow";
colo[6]="crimson";
colo[7]="darkgreen";
colo[8]="firebrick";
colo[9]="indigo";
colo[10]="lightblue";
var num
var thedate=new Date();
var secs=thedate.getSeconds();
secss=secs.toString();
document.write(thedate + "<br>");
document.write(secs + "<br>");
if(secs<=9)
{
num=secs;
}
else
{
num=secss.substr(1);
}
document.write(num + "<br>");
num= num * 1;
nump=num + 1;
document.write(nump + "<br>");
document.write(colo[nump]+"<br>");
document.write("<font color= colo[nump]>blah</font>");
</script>
</head>
thanx
i really need help with this... i am stuck.. i know i am close but can't see it.
What i have to do is get seconds from the date listed.
time always changes therefore, seconds change
what i have problem with is changing the color of the "bluh" word. It should change each first number of the second. Meaning 10-19 one color 20-29 another color 30-39 another and so on.
it looks simple:
Mon Apr 16 01:41:10 EDT 2007
10
0
1 <-- color should change based on this numer
orange
blah
here is my code:
<html>
<head>
<script language=“JavaScript” type="text/javascript">
<!--
var colo= new Array(11)
colo[0]="red";
colo[1]="orange";
colo[2]="green";
colo[3]="blue";
colo[4]="brown";
colo[5]="yellow";
colo[6]="crimson";
colo[7]="darkgreen";
colo[8]="firebrick";
colo[9]="indigo";
colo[10]="lightblue";
var num
var thedate=new Date();
var secs=thedate.getSeconds();
secss=secs.toString();
document.write(thedate + "<br>");
document.write(secs + "<br>");
if(secs<=9)
{
num=secs;
}
else
{
num=secss.substr(1);
}
document.write(num + "<br>");
num= num * 1;
nump=num + 1;
document.write(nump + "<br>");
document.write(colo[nump]+"<br>");
document.write("<font color= colo[nump]>blah</font>");
</script>
</head>
thanx