Millennium Countdown Clock for 3001
08.06.2009, 15:06 | |
Обратный отсчет до 4-го тысячелетия (3001 год) ----------------------------------------------------------------- Пример использования скрипта: :( ----------------------------------------------------------------- Код скрипта: Вставьте следующий код между тегами <BODY></BODY> <center> <form name="clock" onSubmit="0"> <table border=0 cellpadding=0 width=480 height="68"> <tr> <td bgcolor="#000000" align=center width="203" height="25"> <font face="arial" color=white> <B>Current date and time:</B></font> <td bgcolor="#000000" align=center width="267" height="25"> <input type="text" name="face1" size=35 value =" This clock req JavaScript!"> <tr> <td bgcolor="#000000" align=center width="203" height="25"> <font face="arial" color=white> <B>Time till 4th millenium:</B></font> <td bgcolor="#000000" align=center width="267" height="25"> <input type="text" name="face2" size=35> </font> </tr> </table> </form> <script>startclock();startDay();</script> </center> Вставьте следующий код между тегами <HEAD></HEAD> <script language="JavaScript"> // For the clock... var timerID = null var timerRunning = false var dateValue = null; var timerID = null; var timerRunning = false; var date_now = null; var time_left = null; var years_left = 0; var months_left = 0; var days_left = 0; var hours_left = 0; var minutes_left = 0; var seconds_left = 0; // function stopclock(){ if(timerRunning) clearTimeout(timerID); timerRunning = false; } function startclock(){ stopclock(); showtime(); } function startDay(){ var pickDay="SunMonTueWedThrFriSat"; var hereNow = new Date(); var t_day = (hereNow.getDay())+1; var num1 = t_day * 3; var num2 = num1 - 3; var t_day2 = pickDay.substring(num1,num2); var t_date = hereNow.getDate(); var t_month = hereNow.getMonth()+1; var t_year = hereNow.getYear(); years_left = 3000 - t_year; months_left = 12 - t_month; if (t_month==4|t_month==6|t_month==9|t_month==11) days_left = 30 - t_date; else days_left = 31 - t_date; if (t_month == 2) { days_left = 28 - t_date; if (t_year % 4 == 0) days_left += 1; } dateValue=" "+t_day2+", "+t_month+"/"+t_date+"/"+t_year; date_now = dateValue; } function showtime(){ var now = new Date(); var hours = now.getHours(); var minutes = now.getMinutes(); var seconds = now.getSeconds(); hours_left = 23 - hours; minutes_left = 59 - minutes; seconds_left = 60 - seconds; var timeValue = " " + ((hours > 12) ? hours - 12 : hours) timeValue += ((minutes < 10) ? ":0" : ":") + minutes timeValue += ((seconds < 10) ? ":0" : ":") + seconds timeValue += (hours >= 12) ? " P.M." : " A.M." date_now = dateValue + " - " + timeValue time_left = years_left+"yrs,"+months_left+"mth,"+days_left+"dys," time_left += hours_left+"hrs,"+minutes_left+"min,"+seconds_left+"sec"; document.clock.face1.value = date_now; document.clock.face2.value = time_left; timerID = setTimeout("showtime()",1000) timerRunning = true } </script> | |
| |
Просмотров: 393 | Загрузок: 0 | |
Всего комментариев: 0 | |