html网页实用代码

html网页实用代码

wszx01
2024-11-16 / 0 评论 / 4 阅读

一、开站时间开始

             <!-- 开站时间开始1,有天、时、分、秒 -->       
             <span id="timeDate">载入天数...</span><span id="times">载入时分秒...</span> <script language="javascript"> 
    var now = new Date();
    function createtime(){
        var grt= new Date("07/01/2023 00:00:00");/*---这里是网站的启用时间--*/
        now.setTime(now.getTime()+250);
        days = (now - grt ) / 1000 / 60 / 60 / 24;
        dnum = Math.floor(days);
        hours = (now - grt ) / 1000 / 60 / 60 - (24 * dnum);
        hnum = Math.floor(hours);
        if(String(hnum).length ==1 ){hnum = "0" + hnum;}
        minutes = (now - grt ) / 1000 /60 - (24 * 60 * dnum) - (60 * hnum);
        mnum = Math.floor(minutes);
        if(String(mnum).length ==1 ){mnum = "0" + mnum;}
        seconds = (now - grt ) / 1000 - (24 * 60 * 60 * dnum) - (60 * 60 * hnum) - (60 * mnum);
        snum = Math.round(seconds);
        if(String(snum).length ==1 ){snum = "0" + snum;}
        document.getElementById("timeDate").innerHTML = "稳定运行"+dnum+"天";
        document.getElementById("times").innerHTML = hnum + "小时" + mnum + "分" + snum + "秒";
    }
    setInterval("createtime()",250); 
<!-- 开站时间结束 --> 
             <!-- 开站时间开始2,只显示天 -->  
        <span <p> 本页总访问量 <span id="busuanzi_value_site_pv"></span> 次 | @ws01 v1.0.0 2025</p></span>
        <script defer src="https://four-root-occupation.glitch.me/bsz.js"></script>

            <span id="timeDate">载入天数...</span>
        <script language="javascript"> 
            var now = new Date();
            function createtime(){
                var grt= new Date("09/05/2024 00:00:00");/*---这里是网站的启用时间--*/
                now.setTime(now.getTime()+250);
                days = (now - grt ) / 1000 / 60 / 60 / 24;
                dnum = Math.floor(days);
                document.getElementById("timeDate").innerHTML = "稳定运行"+dnum+"天";
            }
            setInterval("createtime()",250); 
        </script> 

二、本页总访问量代码

    <p> 本页总访问量 <span id="busuanzi_value_site_pv"></span> 次</p>
    <script defer src="https://four-root-occupation.glitch.me/bsz.js"></script>

三、几个节日灯笼代码
1、春节快乐灯笼代码

<script defer src="https://four-root-occupation.glitch.me/chunjie-denglong.js"></script>

2、国庆快乐灯笼代码

<script defer src="https://four-root-occupation.glitch.me/guoqing-denglong.js"></script>

3、五一快乐灯笼代码

<script defer src="https://four-root-occupation.glitch.me/wuyi-denglong.js"></script>

4、中秋快乐灯笼代码

<script defer src="https://four-root-occupation.glitch.me/zhongqiu-denglong.js"></script>

5、元旦快乐灯笼代码

<script defer src="https://four-root-occupation.glitch.me/yuandan-denglong.js"></script>

四、html代码变cloudflare workers 代码
html代码最前面加上

addEventListener('fetch', event => {
    event.respondWith(handleRequest(event.request))
  })
  
  async function handleRequest(request) {
    const html = `

最后加上

`;
  
    return new Response(html, {
      headers: { 'content-type': 'text/html;charset=UTF-8' },
    });
  }

五、页脚信息全在一行上
1、添加footer代码,可进行适当调整

         .footer {
          width: 100%;
          max-width: 800px;
          margin: 0 auto;
          padding: 5px 0;
          background-color: #f0f0f0;
          color: #666;
          font-size: 14px;
          text-align: center;
          box-sizing: border-box;
        }

2、网页中添加页脚

      <div class="footer">

            <span id="timeDate">载入天数...</span>
            <script language="javascript"> 
            var now = new Date();
            function createtime(){
                var grt= new Date("01/05/2025 00:00:00");/*---这里是网站的启用时间,分别显示月-日-年 --*/
                now.setTime(now.getTime()+250);
                days = (now - grt ) / 1000 / 60 / 60 / 24;
                dnum = Math.floor(days);
                document.getElementById("timeDate").innerHTML = "稳定运行"+dnum+"天";
            }
            setInterval("createtime()",250); 
        </script> 

        <span <p>  | 本页总访问量 <span id="busuanzi_value_site_pv"></span> 次 | @ws01 v1.0.0 2025</p></span>
        <script defer src="https://four-root-occupation.glitch.me/bsz.js"></script>
0

评论 (0)

取消
您是第 138042 位访客