Shortest way to print current year in a website

前端 未结 12 519
鱼传尺愫
鱼传尺愫 2020-12-07 06:45

I need to update a few hundred static HTML pages that have the copyright date hard coded in the footer. I want to replace it with some JavaScript that will automatically upd

12条回答
  •  独厮守ぢ
    2020-12-07 07:39

    The JS solution works great but I would advise on a server side solution. Some of the sites I checked had this issue of the entire page going blank and only the year being seen once in a while.

    The reason for this was the document.write actually wrote over the entire document.

    I asked my friend to implement a server side solution and it worked for him. The simple code in php

    
    

    Enjoy!

提交回复
热议问题