<
html>
<
head>
<title>Untitled Page</title>
</
head>
<
body>
date in
<i>dd/mm/yyyy format</i>
<
br>
<!-- IN MY EXAMPLE YOU MUST CREATE A LABEL TO SHOW THE DATE OF YOUR TASK -->
<
label id = "lab01">12/12/2006 12:00</label>
<
br />
<
br />
<
script language=javascript>
d=
new Date()
//this is to format the date ant the time in the correct format you use
// add 1 to the day so it begins at 0 !
Theday = d.getDay()+1
// add "0" before the numbers if it is less than 10
if
(Theday < 10)
{Theday =
"0"+Theday}
// add 1 to the month so it begins at 0 !
TheMonth = d.getMonth()+1
// add "0" before the numbers if it is less than 10
if
(TheMonth < 10)
{TheMonth =
"0"+TheMonth}
//Create the date in the good format : the format you want !!!
TheDate = Theday +
"/" + TheMonth + "/" + d.getFullYear()
TheMinute = d.getMinutes()
TheHour = d.getHours()
// I think that you will not use the seconds !!!
TheTime = TheHour +
":" +TheMinute
DateNow = TheDate + TheTime
// COMPARE IF THE DATE IN THE LABEL IS LESS OR GREATER THAN THE Now DATE
if
(document.getElementById("lab01").innerText < DateNow)
{
// change the color of the label
document.getElementById(
"lab01").style.color="#FF0000";
}
else
{
// // change the color of the label
document.getElementById(
"lab01").style.color="#0000FF";
}
</
script>
</
body>
</
html>
this is to give you an example to begin ...
SERVAL
Enter your message below
Sign in or Join us (it's free).