Code hiển thị thời gian

3 659 2
Tài liệu đã được kiểm tra trùng lặp
Code hiển thị thời gian

Đang tải... (xem toàn văn)

Thông tin tài liệu

Code hiển thị thời gian mặc đinh theo máy và lời chào. <div style= "text-align:center; vertical-align:bottom; color:Blue; height:14pt; font-size:11pt;"> <script language="JavaScript" type="text/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 += " năm " + (1900 + d.getYear()) else dateText += " năm " + (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 < 12) { greeting1 = "Chào buổi sáng!" greeting2 = "Kính chúc khách quý một ngày mới thanh bình." timeText = " " + hourValue + ":" + minuteValue + " sáng" } else if (hourValue == 12) { greeting1 = "Chào buổi trưa!" greeting2 ="Chúc bạn có một bữa trưa ngon miệng." timeText = " " + hourValue + ":" + minuteValue + " trưa" } else if (hourValue < 13) { greeting1 = "Chào buổi trưa!" greeting2 = "Chúc bạn có một bữa ăn trưa ngon miệng." timeText = " " + (hourValue - 12) + ":" + minuteValue + " trưa" } else if (hourValue < 18) { greeting1 = "Chào buổi chiều!" greeting2 = "Chúc bạn có buổi chiều bình an." timeText = " " + (hourValue - 12) + ":" + minuteValue + " chiều" } else { greeting1 = "Chào buổi tối!" greeting2 = "Chúc bạn có buổi tối vui vẻ cùng gia đình và ngon giấc." timeText = " " + (hourValue - 12) + ":" + minuteValue + " tối" } // Write the greeting, the date, and the time to the page document.write(greeting1 + " - Hôm nay là " + dateText + ". Lúc " + timeText + ". " + greeting2) //--> </script></div> . Code hiển thị thời gian mặc đinh theo máy và lời chào. <div style= "text-align:center;

Ngày đăng: 20/10/2013, 01:11

Tài liệu cùng người dùng

Tài liệu liên quan