javascript: отсчет времени до завтра
<div id='nextday'></div> <script type='text/javascript'> function NextDayCounter() { var now = new Date(); var tomorrow = new Date(); tomorrow.setDate(tomorrow.getDate()+1); var nextday = new Date((tomorrow.getMonth()+1)+','+tomorrow.getDate()+','+tomorrow.getFullYear()+',00:00:00'); var totalRemains = (nextday.getTime()-now.getTime()); if (totalRemains>1) { var RemainsSec=(parseInt(totalRemains/1000)); var RemainsFullDays=(parseInt(RemainsSec/(24*60*60))); var secInLastDay=RemainsSec-RemainsFullDays*24*3600; var RemainsFullHours=(parseInt(secInLastDay/3600)); if (RemainsFullHours<10){RemainsFullHours='0'+RemainsFullHours}; var secInLastHour=secInLastDay-RemainsFullHours*3600; var RemainsMinutes=(parseInt(secInLastHour/60)); if (RemainsMinutes<10){RemainsMinutes='0'+RemainsMinutes}; var lastSec=secInLastHour-RemainsMinutes*60; if (lastSec<10){lastSec='0'+lastSec}; document.getElementById('nextday').innerHTML = '<span class=\'mess_ok\'>'+RemainsFullHours+':'+RemainsMinutes+':'+lastSec+'</p>'; setTimeout('NextDayCounter()',10); } else { document.getElementById('nextday').innerHTML = 'expired'; } } NextDayCounter(); </script>
Додумался! В div style прописал.
Отличный код! Подскажите как поменять настройки шрифта? То, что нашел поиском не втыкается :-)