Javascript Source Code

Date & Time In Status Bar (version 1)
Example: Tue Sep 28 13:01:15 GMT -0400 (Eastern Daylight Time) 1999

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">

<title></title>

<script language="javascript">

speed=250;
tid=0;
function SC(){
window.status=new Date();
tid=window.setTimeout("SC()",speed);
}
function cleartid(){
window.clearTimeout(tid);
} www.121-java-script-tutorials.com:80
// end-->

</script>

</head>

<body onLoad="SC()">


Date & Time In Status Bar (version 2)
Example: Tuesday, September 28, 1999  01:01:15 pm

<script language="javascript">www.121-java-script-tutorials.com:80 
<!--
function updateTime() {

var day="";
var month="";
var myweekday="";
var year="";
mydate = new Date();
myday = mydate.getDay();
mymonth = mydate.getMonth();
www.121-java-script-tutorials.com:80
myweekday= mydate.getDate();
weekday= myweekday;
myyear= mydate.getYear();
year = myyear
if(myday == 0)
day = " Sunday, "      
else if(myday == 1)
day = " Monday, "
else if(myday == 2)
day = " Tuesday, "   
else if(myday == 3)
day = " Wednesday, "   
else if(myday == 4)
day = " Thursday, "
else if(myday == 5)
day = " Friday, "
else if(myday == 6)
day = " Saturday, "
www.121-java-script-tutorials.com:80
if(mymonth == 0) {
month = "January "}
else if(mymonth ==1)
month = "February "
else if(mymonth ==2)
month = "March "
else if(mymonth ==3)
month = "April "
else if(mymonth ==4)
month = "May "
else if(mymonth ==5)
month = "June "
else if(mymonth ==6)
month = "July "
else if(mymonth ==7)
month = "August "
else if(mymonth ==8)
month = "September "
www.121-java-script-tutorials.com:80
else if(mymonth ==9)
month = "October "
else if(mymonth ==10)
month = "November "
else if(mymonth ==11)
month = "December "

        var now = new Date()
        var theHour = now.getHours()
        var theMin = now.getMinutes()
        var theSec = now.getSeconds()
        var theTime = "" + ((theHour > 12) ? theHour - 12 : theHour)
        
        theTime += ((theMin < 10) ? ":0" : ":") + theMin
        theTime += ((theSec < 10) ? ":0" : ":") + theSec
        theTime += (theHour >= 12) ? " pm" : " am"
                 if (year < 2000) // Y2K Fix, Isaac Powell
                 year = year + 1900; // http://onyx.idbsu.edu/~ipowell

                 window.status = day + month + myweekday + ", " + year + " - "+ theTime
                 timerID = setTimeout("updateTime()",000)
}

//-->
</script>
</head>

<body onLoad="updateTime()" "SC()">
</script>


Date & Time In Status Bar (version 3)
Example: Tuesday, September 28, 1999  01:01:15 pm

<!-- TWO STEPS TO INSTALL STATUS CLOCK:

1. Paste the first code into the HEAD of your HTML document
2. Put the onLoad event handlers to the BODY tag -->

<!-- STEP ONE: Put this code into the HEAD of your HTML document -->

<HEAD>

<SCRIPT LANGUAGE="JavaScript">

<!-- Original: Francis Woodhouse (francis@contessa.u-net.com) -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function runClock() {
theTime = window.setTimeout("runClock()", 1000);
var today = new Date();
var display= today.toLocaleString();
status=display;
}
// End -->
</SCRIPT>

<!-- STEP TWO: Put this code onLoad event handler in the BODY tag -->

<body onLoad="runClock()">

<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>

<!-- Script Size: 0.81 KB -->


Date In Document Body
<script>
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth() www.121-java-script-tutorials.com:80
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
document.write("<small><font color='000000' face='Arial'><b>"+dayarray[day]+", "+montharray[month]+" "+daym+", "+year+"</b></font></small>")
</script>


Automatically Change Last Updated Statement
 

<p><script LANGUAGE="JavaScript">

v = document.lastModified
y = v.slice(0,8)
yy = y.slice(6,8)
if (yy != "69") {
document.write("<br>Last Modified:<BR> ",y,"")
}
</script> </font></td>

</body>

</html>


Javascript Resources

TheFreeSite - a roundup of many of the best Java and JavaScript repositories on the Web.

The Javascript Source -   This site offers lots of free "cut & paste" JavaScript examples for your Web
pages. Source codes included. Examples includes background effects, buttons, calculators,
calendars, clocks, cookies, equivalents, folder trees, forms, games, messages, navigational scripts,
page details, password protection, scrolls, user details and much more.

Jscripts.com - Good selection of useful, easy-to-implement free JavaScripts at this new
resource. You can also see examples of each script in action. Examples include a random quote
selector, screen resolution detection scripts, a random image script, drop-down lists, a JavaScript
clock, rollover image generator and more. There are also other free resources for Webmasters here,
including style sheets.

Javascript Corral

Javascript 4 U - A helpful Web ring focusing on JavaScript sources for Webmasters.
Includes scripts for scrollers; clocks, pop-up Windows, games, dates, forms, buttons, background
changes, animation, menus and more.

Javascript Resources (source of date in document)

 
 

Back to my home page