Announcement

Collapse
No announcement yet.

A JavaScript

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    A JavaScript

    Here is a Java Script made by me. It makes a clock in the Status Bar. Just put this code in your editor if you have homepage.
    <SCRIPT>
    <!-- begin hiding
    // * Script Made By Salman K *
    // * Copyright 1998(C) *
    // * Use this script as long as this header is included *
    // This function displays the time in the status line.
    // Invoke it once to activate the clock; it will call itself from then on.
    function display_time_in_status_line()
    {
    var d = new Date(); // month day, year hours:minutes:seconds
    var y = d.getYear(); // get current year
    var h = d.getHours(); // extract hours: 0 to 23
    var m = d.getMinutes(); // extract minutes: 0 to 59
    var s = d.getSeconds(); // extract seconds: 0 to 59
    var mo = d.getMonth() + 1; // extract months: January toDecember
    var da = d.getDate(); // extract days: 1 to 31
    var ampm = (h >= 12)?"PM":"AM"; // is it am or pm?
    if (h > 12) h -= 12; // convert 24-hour format to 12-hour
    if (h == 0) h = 12; // convert 0 o'clock to midnight
    if (m < 10) m = "0" + m; // convert 0 minutes to 00 minutes, etc.
    var t = mo + '/' + da + '/' + y + ' ' + h + ':' + m + ':' + s + ' ' + ampm; // put it all together

    defaultStatus = t; // display it in the status line
    // arrange to do it again in 1 second.
    setTimeout("display_time_in_status_line()", 1000); // 1000 ms in 1 second
    }
    // end hiding -->
    </SCRIPT>

Working...
X