首页
文章导航
导航
壁纸
留言板
更多
直播
友链
统计
关于
Search
1
经典老电影10部
1 阅读
2
【白嫖攻略】在cloudflare搭建域名邮箱并转发
1 阅读
3
春天来了清新图片
1 阅读
4
Caddy新一代轻量web服务器 配置简单 自动HTTPS 反向代理建站
1 阅读
5
免费二级域名,包括可托管到cf的二级域名
1 阅读
默认
日常
学习
技术
登录
Search
标签搜索
cloudflare
白嫖
安装
脚本
CF
壁纸
图片
docker
Linux
Caddy
代码
哪吒
节点
域名
桌面壁纸
手机壁纸
NAT
LXC
邮箱
优选
ws01
累计撰写
115
篇文章
累计收到
43
条评论
首页
栏目
默认
日常
学习
技术
页面
文章导航
导航
壁纸
留言板
直播
友链
统计
关于
搜索到
1
篇与
的结果
2024-12-18
网页制作常用代码 不断增加 [2025年7月8更新]
网页制作常用代码:一、直接使用节日代码:<!-- <script defer src="https://four-root-occupation.glitch.me/chunjie-denglong.js"></script> 春节快乐--> <!-- <script defer src="https://four-root-occupation.glitch.me/wuyi-denglong.js"></script> 五一快乐--> <!-- <script defer src="https://four-root-occupation.glitch.me/guoqing-denglong.js"></script> 国庆快乐--> <!-- <script defer src="https://four-root-occupation.glitch.me/yuandan-denglong.js"></script> 元旦快乐--> <!-- <script defer src="https://four-root-occupation.glitch.me/zhongqiu-denglong.js"></script> 中秋快乐-->二、本页总访问量1、自建busuanzi<br /> <p> 本页总访问量 <span id="busuanzi_site_pv"></span> 次</p> <script defer src="https://bsz.211119.xyz/js"></script>2、其它busuanzi<br /> <p> 本页总访问量 <span id="busuanzi_value_site_pv"></span> 次</p> <script defer src="https://four-root-occupation.glitch.me/bsz.js"></script>三、网站时间、本页总访问量及其它相关,可灵活修改式样1,访问量、运行时间和版本<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_site_pv"></span> 次 | @ws01 v1.0.0 2025</p></span> <script defer src="https://bsz.211119.xyz/js"></script>式样2,访问量、运行时间、开源和信息<span id="timeDate">载入天数...</span> <script language="javascript"> var now = new Date(); function createtime(){ var grt= new Date("05/09/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> <span <p> | 本页总访问量 <span id="busuanzi_site_pv"></span> 次 | 开源于 GitHub <a href="https://github.com/wszx123/My-Nav" target="_blank">@wszx123</a></p></span> <script defer src="https://bsz.211119.xyz/js"></script>式样3,访问量、运行时间、博客和导航链接<span id="timeDate">载入天数...</span> <script language="javascript"> var now = new Date(); function createtime(){ var grt= new Date("05/09/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> <span <p> | 本页总访问量 <span id="busuanzi_site_pv"></span> 次 | <a href="https://boke.199881.xyz/" target="_blank"> <span style="color: blue;">博客 | <a href="https://www.199881.xyz/" target="_blank"> <span style="color: green;">导航 </p></span> <script defer src="https://bsz.211119.xyz/js"></script> 四、其它常用代码justify-content: space-between; /* 子元素分散排列 */ justify-content: flex-start; /* 子元素从左侧开始排列 */ gap: 20px; /* 子元素之间的空隙 */ background: url('https://121.freewebhostmost.com/') no-repeat center center fixed; /* 背景图片 */ background-color: #f4f4f4; /* 背景色 */ min-height: 60px; /* 最小高度设置为60px */ max-height: 120px; /* 最大高度设置为120px */ font-size: 18px; /* 字号大小*/ border-radius: 5px; /* 四角弧度,一般高为5,50为圆*/ border: 2px solid gray; /* 添加2px灰色边框 */ border: 1px #aaa; /* 添加 1px 和 #aaa 色边框 */ --border-color: #aaa; /* 边框,原#436EEED */ overflow-y: auto; /* 当内容超过最大高度时显示滚动条 */ margin-left: 20px; /* 分类标签右移添加这一行 */ color: green; /* 分类标签字体颜色添加这一行 */ text-align: left; /* 添加左对齐 */ /* 设置文件名的最大宽度,并且超出部分省略显示 */ .file-name { max-width: 200px; /* 设置最大宽度,您可以调整为合适的值 */ overflow: hidden; white-space: nowrap; text-overflow: ellipsis; display: inline-block; /* 确保文件名在一行内显示 */ } footer代码.footer {position: fixed;bottom: 1cm;left: 50%;transform: translateX(-50%);background-color: rgba(230, 230, 250, 0.4);color: #000000;min-width: 400px;max-width: 1120px;height: 55px;text-align: center;margin: 2px auto;padding: 1px;border-radius: 10px;font-size:15px;}五、php代码中单位转换,其中($bytes, 1) 是保留小数点后一位,改2是二位<?php // 格式化文件大小函数 function formatSize($bytes) { $units = ['字节', 'KB', 'MB', 'GB', 'TB']; $unitIndex = 0; while ($bytes >= 1024 && $unitIndex < count($units) - 1) { $bytes /= 1024; $unitIndex++; } return number_format($bytes, 1) . ' ' . $units[$unitIndex]; } ?>六、适配手机时添加1、网页代码在手机上不适配时,在添加以下代码<meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- 添加viewport meta标签,确保页面在移动设备上正确缩放 -->2、大括号中添加相应代码@media (max-width: 768px) { } @media (max-width: 480px) { }七、在html页面添加输入密码才能打开1、密码24小时有效【 使用时请修改 admin 为自己的密码 】 <script> // 页面加载时弹出密码验证 (function() { // 检查是否已存储有效密码 const storedAuth = localStorage.getItem('imagePageAuth'); if (storedAuth) { const authData = JSON.parse(storedAuth); const now = new Date().getTime(); // 检查密码是否在24小时内(24*60*60*1000 = 86400000毫秒) if (now - authData.timestamp < 86400000) { // 密码仍在有效期内,允许访问 return; } else { // 密码已过期,清除存储 localStorage.removeItem('imagePageAuth'); } } // 如果没有有效密码,则要求输入 var password = prompt("请输入密码访问本页面:"); if (password !== "admin") { alert("密码错误!禁止访问。"); window.location.href = "about:blank"; // 密码错误跳转至空白页 } else { // 密码正确,存储当前时间和密码信息(24小时内有效) const authData = { password: password, timestamp: new Date().getTime() }; localStorage.setItem('imagePageAuth', JSON.stringify(authData)); } })(); </script>2、密码当次有效,下一次打开也需要输入【 使用时请修改 admin 为自己的密码 】 <script> // 页面加载时弹出密码验证 (function() { var password = prompt("请输入密码访问本页面:"); if (password !== "admin") { alert("密码错误!禁止访问。"); window.location.href = "about:blank"; // 密码错误跳转至空白页 } })(); </script>
2024年12月18日
0 阅读
4 评论
0 点赞