Sunday, April 8, 2012

0

Code nhắc nhở js

Posted in
<b><font color="yellow"><script language="JavaScript">
<!--
// Store the date In avarlable
d = new Date()
dateText = ""
// Get the cuurent day and convert it to the name of the day
dayValue = d.getDay()
if(dayValue == 0)
dateText += "Chủ Nhật"
else if (dayValue == 1)
dateText += "Thứ Hai"
else if (dayValue == 2)
dateText += "Thứ Ba"
else if (dayValue == 3)
dateText += "Thứ Tư"
else if (dayValue == 4)
dateText += "Thứ Năm"
else if (dayValue == 5)
dateText += "Thứ Sáu"
else if (dayValue == 6)
dateText += "Thứ Bảy"
// Get the current date; if it's before 2000,add 1900
dateText += ", Ngày " + d.getDate()+","
// Get the current month and convert it to the name of the month
monthValue = d.getMonth()
dateText += " "
if (monthValue == 0)
dateText += "Tháng 1"
if (monthValue == 1)
dateText += "Tháng 2"
if (monthValue == 2)
dateText += "Tháng 3"
if (monthValue == 3)
dateText += "Tháng 4"
if (monthValue == 4)
dateText += "Tháng 5"
if (monthValue == 5)
dateText += "Tháng 6"
if (monthValue == 6)
dateText += "Tháng 7"
if (monthValue == 7)
dateText += "Tháng 8"
if (monthValue == 8)
dateText += "Tháng 9"
if (monthValue == 9)
dateText += "Tháng 10"
if (monthValue == 10)
dateText += "Tháng 11"
if (monthValue == 11)
dateText += "Tháng 12"
// Get the current year; if it's before 2000, add 1900
if (d.getYear() < 2000)
dateText += ", Nam " + (1900 + d.getYear())
else
dateText += ", Nam " + (d.getYear())
// Get the current minutes
minuteValue = d.getMinutes()
if (minuteValue < 10)
minuteValue = "0" + minuteValue
// Get the current hours
hourValue = d.getHours()
// Customize the greeting based on the current hours
if (hourValue < 6)
{
greeting = "<center>Chào...! </center>"
greeting1 = "<center>Sao giờ này vẫn vào website? Hãy ngủ để đảm bảo sức khỏe nhé</center>"
}
else if (hourValue < 9)
{
greeting = "<center>Chào Buổi sáng</center>"
greeting1 = "<center>Chúc bạn một buổi sáng tốt lành!</center>"
}
else if (hourValue < 11)
{
greeting = "<center>Sắp Trưa rồi ...^^!</center>"
greeting1 = "<center>Chúc các bạn một ngày thành công và hạnh phúc!.</center>"
}
else if (hourValue < 14)
{
greeting = "<center>Buổi Trưa rồi đấy...^^!</center>"
greeting1 = "<center>Bạn ăn cơm chưa? nếu chưa ăn thì đi ăn đi nhé!</center>"
}
else if (hourValue < 17)
{
greeting = "<center>Buổi Chiều...^^!</center>"
greeting1 = "<center>Hãy Cố gắng hoàn thành công việc trong ngày!</center>"
}
else if (hourValue < 18)
{
greeting = "<center>Sắp tối rồi !</center>"
greeting1 = "<center>Hôm nay bạn có một ngày làm việc và học tập tốt chứ?.^^</center>"
}

else if (hourValue <= 21)
{
greeting = "<center>Chào buổi tối!!</center>"
greeting1 = "<center>Tối rồi nè :D hêhhehe^^</center>"
}
else
{
greeting = "<center>Khuya Rồi đó! </center>"
greeting1 = "<center>Hãy đi ngủ sớm nhé!</center>"
}
// Write the greeting, the date, and the time to the page

document.write(greeting +greeting1)

//-->
</script></font></b>

0 nhận xét: