Web Analytics Made Easy -
StatCounter Adding A time clock to web site - CodingForum

Announcement

Collapse
No announcement yet.

Adding A time clock to web site

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

  • Adding A time clock to web site

    Hi, Im a newbie so please make this as simple as possible.
    I would like to add a time clock to my web site and I have no idea what to do please help, please make instruction as simple as possible. Thank you.

  • #2
    You can use javascript. Also would you just like a clock like 22:37?
    Geoffrey Sneddon

    Comment


    • #3
      This is exactly what I mean Javascript? Its new to me I really dont know what to do I must learn how to use it.

      I run Windows XP
      Time format that I would like to use is long with mouth/day/year 12hour/minutes/seconds no military time


      I never ever have use java script before. I know you might be thinking - oh boy another newbie lol

      Comment


      • #4
        we all started out as newbies and its great to be able to pass on the stuff we learnt.

        Firstly, do you have a hosting package, or one that you will get? Also, will you be using the same time as your server?

        If you'd like it in PHP (which for a newbie PHP is hard) then its simply
        PHP Code:
        date(D d M); 
        at http://www.w3schools.com/php/php_date.asp you can get all the types of PHP date you can use.

        This is a javascript I found:

        Code:
        <div id="digitalclock"></div>
        <script language="javascript">
        function calctime()
        {
        var currenttime = new Date();
        var hours = currenttime.getHours();
        var minutes = currenttime.getMinutes();
        var seconds = currenttime.getSeconds();
        var timesuffix = "AM";
        if (hours > 11)
        {
        timesuffix = "PM";
        hours = hours - 12;
        }
        if (hours == 0)
        {
        hours = 12;
        }
        if (hours < 10)
        {
        hours = "0" + hours;
        }
        if (minutes < 10)
        {
        minutes = "0" + minutes;
        }
        if (seconds < 10)
        {
        seconds = "0" + seconds;
        }
        var clocklocation = document.getElementById('digitalclock');
        clocklocation.innerHTML = hours + ":" + minutes + ":" + seconds + " " + timesuffix;
        setTimeout("calctime()", 1000);
        }
        calctime();
        </script>
        Hope it helped
        Dave

        Comment


        • #5
          thank you Dave but how or what do I do with this code I never have use javascript before


          I have fireworks mx 2004 if thats means anything
          and java 2 platform
          Last edited by majorpain1967; Feb 18, 2004, 05:10 PM.

          Comment


          • #6
            Just put the javascript in your HTML document where you want it.
            Geoffrey Sneddon

            Comment


            • #7
              ok so i cut and paste the code into the html doc. do i put it betwen the head or the body this is what is looks like before editing


              <!-- \/ starthtml -->
              <html>
              <head>
              <!-- The block of META tags is required by Homepage Studio -->
              <!-- to identify this file as created by Freeform Editor. -->
              <!-- Please do not remove them, but feel free to append -->
              <!-- them with your personal data below. Meta tags help -->
              <!-- search engines identify the content of your page. -->
              <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
              <META NAME="keywords" CONTENT="enter keywords here">
              <META NAME="description" CONTENT="enter a description here">
              <META NAME="author" CONTENT="enter your name here">
              <META NAME="generator" CONTENT="FreeFormEditor 1.0">
              <TITLE></TITLE>
              </head>
              <body bgcolor="#FFFFFF" text="#000000" link="#0000EE" vlink="#551A8B">

              </body>
              </html>
              <!-- /\ end html -->

              Comment


              • #8
                Body.
                Geoffrey Sneddon

                Comment


                • #9
                  ok i maybe almost there
                  here is what my html looks like just let me know if the code looks right note: that its the code mentioned by Dave above
                  I see no clock in home page


                  <html>
                  <HEAD>
                  <META content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
                  <META content="0" http-equiv="Expires">
                  <META content="1.0" name="TRELLIX_BUILDER_VER"><META name="TRELLIX_OPEN_SITE_COMMAND" content="http://build.tripod.lycos.com:80/servlet/SiteBuilderServlet?fUrl=/trellix/sitebuilder/f_error.html&sUrl=/trellix/sitebuilder/f_edit_page.html&Command=OpenSite&FileName=1021250373342978396/site.xml"></META><META name="categories" content=""><script language="Javascript"><!--
                  var dir = window.location.pathname;
                  dir = dir.substring(0, dir.lastIndexOf('/'));
                  var sitename = 'welcometomajorpainswebsite';
                  if( dir.search(sitename + '$') == -1 ) {
                  dir += '/' + sitename;
                  }
                  document.write('<base href="' + window.location.protocol + '//' + window.location.host + dir + '/">');
                  // --></script><script language="Javascript"><!--
                  document.isTrellix = 1;
                  // --></script>
                  <title>WELCOME TO =MAJOR*PAIN='S WEB SITE</title>
                  </HEAD>
                  <body vlink="#ffffff" alink="#ffffff" link="#ff6600" bgcolor="Black" background="/imagelib/sitebuilder/layout/gooorange_back.gif" marginheight="0" marginwidth="0" topmargin="0" leftmargin="0">
                  <table cellpadding="0" cellspacing="0" border="0">
                  <tr>
                  <td>
                  <table cellspacing="0" cellpadding="0" border="0">
                  <tr>
                  <td valign="top" width="398"><img alt="" height="74" width="398" src="/imagelib/sitebuilder/layout/gooorange_1.gif"></td>
                  </tr>
                  <tr>
                  <td width="158"><img alt="" height="124" width="158" src="/imagelib/sitebuilder/layout/gooorange_2.gif"></td>
                  </tr>
                  </table>
                  </td><td valign="top" width="362">
                  <table cellspacing="0" cellpadding="0" border="0">
                  <tr>
                  <td align="right" width="362"></td>
                  </tr>
                  <tr>
                  <td align="right" width="362"><font face="Courier" size="4" color="#FF6600"><b>WELCOME TO =MAJOR*PAIN='S WEB SITE</b></font></td>
                  </tr>
                  </table>
                  </td>
                  </tr>
                  </table>
                  <table cellpadding="0" cellspacing="0" border="0">
                  <tr>
                  <td valign="top" width="158">
                  <table cellpadding="0" cellspacing="0" border="0">
                  <tr>
                  <td>
                  <table border="0" cellspacing="0" cellpadding="0">
                  <tr>
                  <td align="left" valign="top" width="25"><img alt="" height="31" width="25" src="/imagelib/sitebuilder/layout/gooorange_3.gif"></td><td align="left" valign="top">
                  <table cellspacing="0" cellpadding="0" border="0">
                  <tr>
                  <td colspan="2" align="center" valign="top" width="131">
                  <!--navbar Type="vert" includes-home="N" uses-text="Y" face="Courier" size="2" color="#ff6600" style="0"-->
                  <table background="/imagelib/sitebuilder/layout/spacer.gif">
                  <tr>
                  <td align="center"><font face="Courier" size="2" color="#ff6600"><a class="NavBar" href="id1.html"><font color="#ff6600">TEST PAGE ONLY</font></a></font></td>
                  </tr>
                  </table>
                  <!--/navbar-->
                  </td>
                  </tr>
                  </table>
                  </td>
                  </tr>
                  </table>
                  </td>
                  </tr>
                  </table>
                  </td><td width="10"><img alt="" height="1" width="10" src="/imagelib/sitebuilder/layout/spacer.gif"></td><td valign="top" width="592">
                  <table cellpadding="0" cellspacing="0" border="0">
                  <tr>
                  <td colspan="3" valign="top" width="591">
                  <!--area Type="subhead" face="Courier" size="3" color="#ff6600" style="1"--><div><img src="http://major_pain1967.tripod.com//sitebuildercontent/sitebuilderpictures/wellpage.gif" border="" alt="wellpage.gif" vspace="0" hspace="0"></div><!--/area--></td>
                  </tr>
                  <tr>
                  <td colspan="3" width="591"><img alt="" height="20" width="1" src="/imagelib/sitebuilder/layout/spacer.gif"></td>
                  </tr>
                  <tr>
                  <td valign="top" width="391">
                  <table cellspacing="0" cellpadding="0" border="0">
                  <tr>
                  <td valign="top" width="390">
                  <!--area Type="main" face="Courier" size="2" color="#ff6600" style="0"--><p><font face="Courier" size="2" color="#ff6600">Here is a list of ~HAS~ members in Delta Force 2</font></p><p><font face="Courier" size="2" color="#ff6600"><b>My Favorites</b></font></p><p><font face="Courier" size="2" color="#ff6600">Favorite Band or Musician: Metallica<br>Favorite TV show: The Three Stooges<br>Favorite movie: Excalibur<br>
                  Favorite sports team: Chicago Bears<br>
                  Favorite food: Eggs</font></p><p><font face="Courier" size="2" color="#ff6600"><b>My Hobbies</b></font></p><p><font face="Courier" size="2" color="#ff6600">I Like Football,Computers,Going Out To Bars,Fishing,Camping,Hiking,Bowlimg,Getting Away From City Life.</font></p><p><font face="Courier" size="2" color="#ff6600"><b>Most Admired</b></font></p><p><font face="Courier" size="2" color="#ff6600">Godzilla</font></p><!--/area--></td>
                  </tr>
                  </table>
                  </td><td width="10"><img alt="" height="1" width="10" src="/imagelib/sitebuilder/layout/spacer.gif"></td><td align="left" valign="top" width="190">
                  <table border="0" valign="top" cellspacing="0" cellpadding="0">
                  <tr>
                  <td valign="top" align="left" colspan="2"><img alt="" height="33" width="143" src="/imagelib/sitebuilder/layout/gooorange_7.gif"></td>
                  </tr>
                  <tr>
                  <td align="left" valign="top"><img alt="" height="128" width="22" src="/imagelib/sitebuilder/layout/gooorange_8.gif"></td><td width="167" align="left" valign="top">
                  <!--area Type="area_a" face="Courier" size="2" color="#ff6600" style="0"--><p><div align="CENTER"><img src="/imagelib/sitebuilder/layout/megaphone_medium.jpg" border="" alt="People shouting at the world over megaphones; Size=240 pixels wide" width="240"></div></p><!--/area--></td>
                  </tr>
                  </table>
                  </td><td><img alt="" height="1" width="10" src="/imagelib/sitebuilder/layout/spacer.gif"></td>
                  </tr>
                  <tr>
                  <td colspan="3" valign="top" width="591">
                  <center>
                  <img alt="" height="37" width="355" src="/imagelib/sitebuilder/layout/gooorange_div.gif"></center>
                  </td>
                  </tr>
                  <tr>
                  <td valign="top" width="380">
                  <!--area Type="area_b" face="Courier" size="2" color="#ff6600" style="0"--><p><div align="CENTER"><font face="Courier" size="2" color="#ff6600"><b>Favorite Links</b></font></div></p><p><a href="http://This%20will%20be%20a%20link%20to%20my%20other%20web%20sites" target="_self" name="" title=""><font face="Courier" size="2" color="#ff6600">This will be a link to my other web sites</a></font></p><p><a href="http://This%20will%20be%20a%20link%20to%20my%20other%20web%20site" target="_self" name="" title=""><font face="Courier" size="2" color="#ff6600">This will be a link to my other web site</a></font></p><!--/area--></td>
                  </tr>
                  <tr>
                  <td valign="top" width="380"></td>
                  </tr>
                  <tr>
                  <td colspan="3" valign="top" width="591">
                  <center>
                  <img alt="" height="37" width="355" src="/imagelib/sitebuilder/layout/gooorange_div.gif"></center>
                  </td>
                  </tr>
                  <tr>
                  <td colspan="3" valign="top" width="592">
                  <!--area Type="runner" face="Courier" size="2" color="#ff6600" style="0"--><p><!--gem:tlx.tlxinv.general--><!--end gem--></div></p><!--/area--></td>
                  </tr>
                  </table>
                  </td>
                  </tr>
                  </table>
                  <body>
                  <div id="digitalclock"></div>
                  <script language="javascript">
                  function calctime()
                  {
                  var currenttime = new Date();
                  var hours = currenttime.getHours();
                  var minutes = currenttime.getMinutes();
                  var seconds = currenttime.getSeconds();
                  var timesuffix = "AM";
                  if (hours > 11)
                  {
                  timesuffix = "PM";
                  hours = hours - 12;
                  }
                  if (hours == 0)
                  {
                  hours = 12;
                  }
                  if (hours < 10)
                  {
                  hours = "0" + hours;
                  }
                  if (minutes < 10)
                  {
                  minutes = "0" + minutes;
                  }
                  if (seconds < 10)
                  {
                  seconds = "0" + seconds;
                  }
                  var clocklocation = document.getElementById('digitalclock');
                  clocklocation.innerHTML = hours + ":" + minutes + ":" + seconds + " " + timesuffix;
                  setTimeout("calctime()", 1000);
                  }
                  calctime();
                  </script>
                  </body>
                  </html>




                  Do I remove </script>

                  Comment


                  • #10
                    You've got <body> just before the start of the script, remove that.
                    Geoffrey Sneddon

                    Comment

                    Working...
                    X