automatically insert current year

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dave

    automatically insert current year

    Hi,
    Can anyone tell me a simple way of inserting some sort of code into a
    Dreamweaver template (it goes at the bottom of the page in Copyright
    info) that will cause the current year to be automatically inserted at
    spot X when the pages are viewed that were produced from the template
    or are linked to it?

    Thanks
    Dave
  • LJL

    #2
    Re: automatically insert current year

    zeitsparer@yaho o.com.au (Dave) wrote in
    news:6e9ce77e.0 402052154.2b58d a32@posting.goo gle.com:
    [color=blue]
    > Hi,
    > Can anyone tell me a simple way of inserting some sort of code into a
    > Dreamweaver template (it goes at the bottom of the page in Copyright
    > info) that will cause the current year to be automatically inserted at
    > spot X when the pages are viewed that were produced from the template
    > or are linked to it?
    >
    > Thanks
    > Dave
    >[/color]

    In the HTML portion of the page write:


    Copyright &copy; <SCRIPT>
    <!--
    var year=new Date();
    year=year.getYe ar();
    if (year<1900) year+=1900;
    document.write( year);
    //-->
    </SCRIPT> Your Name, All Rights Reserved.



    This will get the date, grab the year from the date, check to make sure it
    is in 4-digit format (just in case) and insert it after a copyright "C" in
    a circle and before your name. If put in as it is here, it should look
    like this:

    Copyright © 2004 Your Name, All Rights Reserved

    Good luck, LJL

    Comment

    • Janwillem Borleffs

      #3
      Re: automatically insert current year


      "LJL" <none@nowhere.c om> wrote in message
      news:Xns94873DD A7CF21nonenowhe recom@207.69.15 4.201...[color=blue]
      > In the HTML portion of the page write:
      >
      >
      > Copyright &copy; <SCRIPT>
      > <!--
      > var year=new Date();
      > year=year.getYe ar();
      > if (year<1900) year+=1900;
      > document.write( year);
      > //-->
      > </SCRIPT> Your Name, All Rights Reserved.
      >[/color]

      Why not just:

      Copyright &copy; <script type="text/javascript">
      document.write( new Date().getFullY ear());
      </script> Your Name, All Rights Reserved.

      ?


      JW



      Comment

      • Erwin Moller

        #4
        Re: automatically insert current year

        Dave wrote:
        [color=blue]
        > Hi,
        > Can anyone tell me a simple way of inserting some sort of code into a
        > Dreamweaver template (it goes at the bottom of the page in Copyright
        > info) that will cause the current year to be automatically inserted at
        > spot X when the pages are viewed that were produced from the template
        > or are linked to it?
        >
        > Thanks
        > Dave[/color]

        Hi Dave,

        Without any knowlegde of Dreamweaver whatsoever, try this:

        current year:
        <script type="text/javascript">
        D = new Date();
        year = D.getFullYear() ;
        document.write( year);
        </script>

        It produces the year as set on the clientmachine.

        Regards,
        Erwin Moller

        Comment

        • Dave

          #5
          Re: automatically insert current year

          Thank you to you all for the kind suggestions - they all work!

          Dave

          Erwin Moller <since_humans_r ead_this_I_am_s pammed_too_much @spamyourself.c om> wrote in message news:<40237a69$ 0$326$e4fe514c@ news.xs4all.nl> ...[color=blue]
          > Dave wrote:
          >[color=green]
          > > Hi,
          > > Can anyone tell me a simple way of inserting some sort of code into a
          > > Dreamweaver template (it goes at the bottom of the page in Copyright
          > > info) that will cause the current year to be automatically inserted at
          > > spot X when the pages are viewed that were produced from the template
          > > or are linked to it?
          > >
          > > Thanks
          > > Dave[/color]
          >
          > Hi Dave,
          >
          > Without any knowlegde of Dreamweaver whatsoever, try this:
          >
          > current year:
          > <script type="text/javascript">
          > D = new Date();
          > year = D.getFullYear() ;
          > document.write( year);
          > </script>
          >
          > It produces the year as set on the clientmachine.
          >
          > Regards,
          > Erwin Moller[/color]

          Comment

          Working...