PDA

View Full Version : Simple Time Script



[WF][10] Col.TheNick
06-12-2006, 06:24 PM
SImple Time Script

<script language="JavaScript"> function resetIt() {

var timerID = null;
var timerRunning = false;

if(timerRunning)
clearTimeout(timerID);
timerRunning = false;

var timeNow = new Date();
var hours = timeNow.getHours();
var minutes = timeNow.getMinutes();
var seconds = timeNow.getSeconds();
var timeValue = "" + ((hours >12) ? hours -12 :hours)
timeValue = ((timeValue <10)? "0":"") + timeValue
timeValue += ((minutes < 10) ? ":0" : ":") + minutes
timeValue += ((seconds < 10) ? ":0" : ":") + seconds
timeValue += (hours >= 12) ? " PM" : " AM"
timerID = setTimeout("resetIt()",100);
timerRunning = true;

var dateNow = new Date();
var days = new Array('Sunday','Monday','Tuesday','Wednesday',
'Thursday','Friday','Saturday');

var months = new
Array('January','February','March','April','May',' June','July',
'August','September','October','November','Decembe r');

var date = ((dateNow.getDate()<10) ? "0" : "")+ dateNow.getDate();
function y2k(number){return (number < 1000) ? number + 1900 : number;}

today = timeValue + " " + days[dateNow.getDay()] + " " +
months[dateNow.getMonth()] + " " +
date + " " +
(y2k(dateNow.getYear()));
if(document.all || document.getElementById){ // Browser Check
document.title = today.toString();
}else {
self.status = today.toString(); // Default to status.
}
}


resetIt();

</script>

omgDAN!
06-12-2006, 06:26 PM
thanks may come in useful.

Liberation
06-12-2006, 06:44 PM
Thanks Nick ^^

tekni
06-12-2006, 06:47 PM
Where'd you take that from?

You couldn't even code your own layout, let along JS.

ebay
06-12-2006, 07:03 PM
javascriptkit i guess!

omgDAN!
06-12-2006, 07:05 PM
Where'd you take that from?

You couldn't even code your own layout, let along JS.

Oh sometimes I just wish you would shut the hell up, and other times you are nice.
It's a forum member trying to help the other members. fgs.

tekni
06-12-2006, 07:08 PM
Oh sometimes I just wish you would shut the hell up, and other times you are nice.
It's a forum member trying to help the other members. fgs.
The fact he never stated where he got it from, the source or anything makes people believe that he coded it himself.

Which will end up false accusations blah blah blah.

So if I posted every DHTML; JS; PHP; CSS code, every one a new thread... that'd be helping out?

Want to hide these adverts? Register an account for free!