SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: Simple codes

  1. #1
    SitePoint Enthusiast ttcf's Avatar
    Join Date
    Nov 2001
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Simple codes

    does anyone know a script that wil just grab the date from the viewers computer and show it on the webpage.

  2. #2
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Post Date

    <HEAD>

    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function dateinbar()
    {
    var d=new Date();
    var mon=d.getMonth()+1;
    var year=d.getFullYear();
    var date=d.getDate();
    var h=d.getHours();
    var m=d.getMinutes();
    var s=d.getSeconds();
    var AorP=" ";
    if (h>=12)
    AorP="P.M.";
    else
    AorP="A.M.";
    if (h>=13)
    h=h-12;
    if (s<10)
    s="0"+s;
    if (m<10)
    m="0"+m;
    defaultStatus = "Current date: "+mon+"/"+date+"/"+year+" "+" and time: " + h+":"+m+":"+s+" "+AorP ;
    setTimeout("dateinbar()",1000);

    rerurn defaultStatus

    }
    dateinbar();
    // -->
    </script>

    </HEAD>


    <BODY>

  3. #3
    SitePoint Enthusiast ttcf's Avatar
    Join Date
    Nov 2001
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    thanks

    don't i need a line to put in the body to?


    <"javascript:dateinbar()"> ???????

  4. #4
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Wink Nope

    Its already in there

    "dateinbar();"

    and take out rerurn defaultStatus otherwise do it the way you mentioned
    Last edited by Andrew-J2000; Feb 18, 2002 at 07:10.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •