HTML how do I insert dynamic date in webpage

前端 未结 8 2101
暖寄归人
暖寄归人 2021-01-05 14:40

I have a static webpage, nothing changes dynamically. However the client wants a date insert into text within the page. The date will always be the current daet plus one day

8条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-05 15:20

    You can do that in javascript. http://www.tizag.com/javascriptT/javascriptdate.php

    Then you can add for example a span tag in your text, and insert the date with javascript. If you can use jQuery, you can do something like:

    html:

    Tomorrow:

    javascript:

    $(function() {
        var date = new Date()
        $(".tomorrow").html(date.getDate() + 1) // you'll have to search how to format the date
    });
    

提交回复
热议问题