组装首页:其他组件html、css移入JS中再引入首页

组装首页

 

<!DOCTYPE html>
<html lang="zh-CN"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>组装首页</title><style>* {margin: 0;padding: 0;box-sizing: border-box;/* 禁止文本选中 */user-select: none;}/* 登录界面样式 */html,body {height: 100%;}body {display: flex;}.wrapper {width: 100%;background: linear-gradient(to bottom, #f7c750, #ff6d6d);background-image: url('file:///D:/img/开门.png');background-repeat: no-repeat;background-attachment: fixed;background-size: 100% 100%;}.container {width: 98%;height: 96%;display: flex;flex-direction: column;/* 设置为列方向 */position: relative;border-radius: 8px;margin: 2% auto;border: 1px solid rgba(255, 255, 255, 6);background-image: linear-gradient(to top left,rgba(255, 255, 255, 0.1),rgba(255, 255, 255, 0.1) 30%,rgba(255, 255, 255, 0));backdrop-filter: blur(4px);box-shadow:inset 4px 4px 3px rgba(255, 255, 255, 0.6),inset -4px -4px 3px rgba(0, 0, 0, 0.6);}.welcome-box {width: 100%;height: 50%;/* 调整高度 */position: absolute;/* 保持绝对定位 */left: 0;top: 0;transition: transform 0.5s ease-in-out;/* 保持过渡效果 */border: 5px;border-radius: 8px 8px 0 0;background-image: url('file:///D:/img/上.png');background-repeat: no-repeat;background-attachment: fixed;background-size: 100% 100%;box-shadow:inset 2px 2px 3px rgba(255, 255, 255, 0.6),inset -2px -2px 3px rgba(0, 0, 0, 0.6);text-shadow: 1px 1px 1px #100000;z-index: 9;}.container p,.container h1 {color: rgb(255, 255, 255);}.welcome-box h1 {margin-top: 45px;text-align: center;letter-spacing: 5px;text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);}.welcome-box p {height: 25px;line-height: 25px;text-align: center;margin: 10px 0;font-weight: bold;text-shadow: 2px 2px 2px #100000;}.image-container {width: 100px;height: 100px;margin: 10px auto;border-radius: 50%;overflow: hidden;background: rgba(75, 82, 88, 0.524);backdrop-filter: blur(5px);opacity: 0.9;box-shadow:inset 2px 2px 3px rgba(255, 255, 255, 0.6),inset -2px -2px 3px rgba(0, 0, 0, 0.6);text-shadow: 1px 1px 1px #100000;z-index: 99;}.image-container img {width: 100%;height: 100%;}.form-container {margin: 120px auto;}.form-container,.registration-container {flex: 1;height: 100%;margin: 40px auto;}.title-container {height: 50px;line-height: 4px;}.title-container h1 {text-align: center;letter-spacing: 5px;background-image: linear-gradient(to top left,rgba(0, 0, 0, 0.2),rgba(0, 0, 0, 0.2) 30%,rgba(0, 0, 0, 0));box-shadow:inset 2px 2px 3px rgba(255, 255, 255, 0.6),inset -2px -2px 3px rgba(0, 0, 0, 0.6);text-shadow: 1px 1px 1px #100000;}.input-group {display: flex;flex-direction: column;align-items: center;}.container input {width: 60%;height: 25px;margin-bottom: 20px;text-indent: 4px;border-radius: 3px;box-shadow: 0px 0px 5px 5px #f7c750;}.form-container input[type="password"] {transform: translateY(20px);}.container input:focus {color: rgb(61, 185, 71);}.button-container {display: flex;justify-content: center;}.form-container .button-container {margin-top: 45px;}.container button {width: 100px;height: 30px;margin: 0 3px;border: none;border-radius: 3px;color: #fff;background-color: #2196F3;background-image: linear-gradient(to top left,rgba(0, 0, 0, 0.2),rgba(0, 0, 0, 0.2) 30%,rgba(0, 0, 0, 0));box-shadow:inset 2px 2px 3px rgba(255, 255, 255, 0.6),inset -2px -2px 3px rgba(0, 0, 0, 0.6);text-shadow: 1px 1px 1px #100000;}.register-btn {background-color: #4CAF50;}button:hover {cursor: pointer;background-color: aqua;}.button-container p {height: 30px;line-height: 30px;padding: 0 10px;font-size: 14px;background-color: #f56c6c;border-radius: 3px;background-image: linear-gradient(to top left,rgba(0, 0, 0, 0.2),rgba(0, 0, 0, 0.2) 30%,rgba(0, 0, 0, 0));box-shadow:inset 2px 2px 3px rgba(255, 255, 255, 0.6),inset -2px -2px 3px rgba(0, 0, 0, 0.6);text-shadow: 1px 1px 1px #d3bfbf;}button:hover,.button-container p:hover {cursor: pointer;background-color: rgb(251, 16, 16);background-image: linear-gradient(to top left,rgba(0, 0, 0, 0.2),rgba(0, 0, 0, 0.2) 30%,rgba(0, 0, 0, 0));box-shadow:inset 2px 2px 3px rgba(255, 255, 255, 0.6),inset -2px -2px 3px rgba(0, 0, 0, 0.6);}.button-container p:active,button:active {box-shadow:inset -2px -2px 3px rgba(255, 255, 255, 0.6),inset 2px 2px 3px rgba(0, 0, 0, 0.6);}.container ::placeholder {color: rgb(36, 192, 127);letter-spacing: 25px;font-size: 15px;}/* 登录界面样式 结束 *//* 登录后的样式 */#mask {display: none;width: 100%;transition: background-color 0.3s, color 0.3s;background: #0b1b2c;/* 默认背景色 */color: #ffffff;}nav {background-color: #cbcbcb;padding: 5px;}nav a {color: #007bff;padding: 4px 8px;text-decoration: none;transition: background-color 0.3s;}nav a:hover {background-color: #ff000097;color: white;backdrop-filter: blur(5px);}.nav-active {display: inline-block;transform: scale(1.5);transform-origin: center;margin-left: 10px;padding: 0;border-radius: 3px;background-color: #ff0000;color: white;text-shadow: 1px 1px 1px #000000;}.content {display: none;padding: 20px;}.content p {background-color: #144756;color: #f56c6c;text-shadow: 1px 1px 1px #000000;}.active {display: block;}#mask.day-mode {background-color: #f0f0f0;color: #000000;}nav.day-mode {background-color: #cccccc;}.toggle-day-mode {float: right;}/* 调整我的标志位置 */#logo {position: absolute;top: -28px;right: 175px;}/* 登录后的结束 */</style>
</head><body><!-- 登录界面.wrapper --><div class="wrapper"><div class="container"><div class="welcome-box"><h1>欢迎</h1><p>加入我们!</p><div class="image-container"><img src="file:///D:/img/空.png" alt="正方形图片"></div></div><div class="registration-container"><div class="title-container"><h1>注册</h1></div><div class="input-group"><input type="text" id="reg-username" placeholder="用户名"><input type="password" id="reg-password" placeholder="密码"><input type="password" id="reg-confirm-password" placeholder="确认密码"></div><div class="button-container"><button class="register-btn" onclick="register()">注册</button><p onclick="mySwitch()">已有账号?去登录</p></div></div><div class="form-container"><div class="title-container"><h1>登录</h1></div><div class="input-group"><input type="text" id="login-username" placeholder="用户名"><input type="password" id="login-password" placeholder="密码"></div><div class="button-container"><button onclick="login()">登录</button><p onclick="mySwitch()">没有账号?去注册</p></div></div></div></div><!-- 登录界面.wrapper结束 --><!-- 登录后的内容#mask --><div id="mask"><!-- 导航栏 nav--><nav><!-- 引入我的标志和外部 JavaScript 文件 --><div id="logo">我的标志</div><script src="logo.js"></script><!-- 导航栏链接 --><a href="#" onclick="showPage('home')">首页</a><a href="#" onclick="showPage('writeDown')">记下来</a><a href="#" onclick="showPage('webPage')">网页</a><a href="#" onclick="showPage('countdown')">倒计时</a><a href="#" onclick="showPage('about')">关于</a><!-- 添加白天模式切换链接 --><a href="#" class="toggle-day-mode" onclick="toggledayMode()">切换白天模式</a><button onclick="logout()"style="background-color: #f56c6c; border: none; border-radius: 5px; cursor: pointer; float: right;padding: 0 2px;">退出登录</button></nav><div id="home" class="content active"><h1>欢迎来到首页</h1><p>内容正在筹备中...</p></div><div id="writeDown" class="content"><h1>记下来</h1><p>1.自从有了手机,每天过着李世民的生活,有人献歌献舞,表演才艺,朕还要挨个批阅点评,盖红章,朕甚是劳累。</p><p>2.内容正在筹备中...</p></div><div id="webPage" class="content"><h1>网页</h1><p>内容正在筹备中... </p></div><div id="countdown" class="content"><h1>倒计时</h1><p>内容正在筹备中...</p></div><div id="about" class="content"><h1>关于</h1><p>项目初始创建时间:2024年10月09日 </p></div></div><!-- 登录后的内容#mask结束 -->
</body>
<!-- 登录界面滑动引入的js文件 src="http://code.jquery.com/jquery-latest.js"-->
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>let flag = true;const users = [{ username: "admin", password: "admin123" }, // 添加管理员账户{ username: "1", password: "1" } // 添加管理员测试账户]; // 存储用户信息的数组const mySwitch = () => {if (flag) {$(".welcome-box").css({"transform": "translateY(100%)","background-image": "url('file:///D:/img/下.png')", // 修改为背景图片"border-radius": "0 0 8px 8px" // 添加边框圆角});$("img").attr("src", "file:///D:/img/荧.png");$("img").css("transform", "scale(1.3)"); // 这个图片返回原大小,添加缩放效果} else {$(".welcome-box").css({"transform": "translateY(0%)","background-image": "url('file:///D:/img/上.png')", // 修改为背景图片"border-radius": "8px  8px 0 0" // 添加圆角效果});$("img").attr("src", "file:///D:/img/空.png");$("img").css("transform", "scale(1)"); // 这个图片返回原大小,添加缩放效果}flag = !flag;}const register = () => {const username = document.getElementById("reg-username").value;const password = document.getElementById("reg-password").value;const confirmPassword = document.getElementById("reg-confirm-password").value;// 检查账号和密码是否为空if (!username || !password) {alert("账号和密码不能为空!");return;}if (password !== confirmPassword) {alert("密码不匹配!");return;}// 检查用户名是否已存在const userExists = users.some(user => user.username === username);if (userExists) {alert("用户名已存在,请选择其他用户名!");return;}// 注册用户users.push({ username, password });alert("注册成功,请登录!");mySwitch(); // 切换到登录界面}const login = () => {const username = document.getElementById("login-username").value;const password = document.getElementById("login-password").value;// 验证用户信息const user = users.find(user => user.username === username && user.password === password);if (user) {alert("登录成功!");// 显示受保护的页面document.getElementById("mask").style.display = "block"; // 显示内容document.querySelector('.wrapper').style.display = "none"; // 隐藏注册和登录盒子} else {alert("用户名或密码错误!");}}const logout = () => {document.getElementById("mask").style.display = "none"; // 隐藏受保护的内容document.querySelector('.wrapper').style.display = "block"; // 显示注册和登录盒子document.getElementById("login-username").value = ""; // 清空登录用户名输入框document.getElementById("login-password").value = ""; // 清空登录密码输入框}// 导航页面切换函数function showPage(page) {// 隐藏所有内容并移除激活样式document.querySelectorAll('.content').forEach(content => content.classList.remove('active'));document.querySelectorAll('nav a').forEach(link => link.classList.remove('nav-active'));// 显示当前选择的内容const selectedContent = document.getElementById(page);selectedContent.classList.add('active');document.querySelector(`nav a[onclick="showPage('${page}')"]`).classList.add('nav-active');}// 在页面加载时显示首页并激活相应的样式document.addEventListener('DOMContentLoaded', function () {showPage('home');});// 切换白天模式函数function toggledayMode() {document.getElementById("mask").classList.toggle('day-mode');document.querySelector('nav').classList.toggle('day-mode');}
</script></html>

logo.js

const styles = `figure.logo {width: 262px;height: 50px;transform: scale(0.5) translate(110px, 50px);border-radius: 50%;background: #f30303;box-shadow: inset 4px 4px 4px rgba(255, 255, 255, 0.6),inset -4px -4px 5px rgba(0, 0, 0, 0.6);z-index: 99;}figure.logo figcaption {background: hsl(0, 0%, 0%);background-clip: text;-webkit-background-clip: text;-webkit-text-fill-color: transparent;font-weight: bold;box-shadow: inset 4px 4px 4px rgba(255, 255, 255, 0.6), inset -4px -4px 5px rgba(0, 0, 0, 0.6);letter-spacing: -3px;line-height: 45px;border-radius: 50%;font-size: 40px;width: 152px;}figure.logo .my_name1 {text-shadow: 1px 1px 1px rgba(255, 255, 255, 0.726);clip-path: polygon(0% 0%, 100% 0%, 100% 50%, 0% 50%);transform: translate(35%, 0%);-webkit-text-stroke: #fffbfb 1px;}figure.logo .my_name2 {text-shadow: 1px 1px 1px hsla(160, 100%, 37%, 0.555);clip-path: polygon(0% 50%, 100% 50%, 100% 100%, 0% 100%);transform: translate(35%, -93%);-webkit-text-stroke: #ffffff 1px;}figure.logo .avatarYing,figure.logo .avatarKong {position: absolute;width: 60px;height: 35px;background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), rgba(243, 3, 3, 0.8));border-radius: 50%;margin-left: 204px;}figure.logo img {--s: 60px;--b: -5px;--f: 1;--bgOptions: content-box no-repeat center/ calc(100% / var(--f)) 100%;--shrink: calc((var(--s) / var(--f) - var(--s)) / 2 - var(--b));padding-top: 15px;width: var(--s);height: var(--s);transform: scale(var(--f));transition: 0.5s;mask: linear-gradient(#000 0 0) no-repeat center calc(0px - var(--shrink)) / calc(100% / var(--f) - 2 * var(--b)) 50%,radial-gradient(circle closest-side, #fff 60%, transparent) var(--bgOptions);}figure.logo .avatarYing {margin-left: 0px;margin-top: -83px;}figure.logo .avatarKong {margin-left: 202px;margin-top: 8px;}figure.logo .kong {margin-top: -40px;}figure.logo .ying {margin-top: -44px;--f: 1.4;}
`;const styleSheet = document.createElement("style");
styleSheet.type = "text/css";
styleSheet.innerText = styles;
document.head.appendChild(styleSheet);const logoHtml = `<figure class="logo"><div class="avatarKong"><a href="https://blog.csdn.net/lulei5153?spm=1011.2415.3001.5343" title="与妖为邻CSDN博客" target="_blank"><img class="kong" src="file:///D:/img/空.png" alt="与妖为邻"></a></div><figcaption class="my_name1">与妖为邻</figcaption><figcaption class="my_name2">与妖为邻</figcaption><div class="avatarYing"><a href="file:///D:/web/html%E9%A6%96%E9%A1%B5/%E5%A4%87%E5%BF%98%E5%BD%95.html" title="首页" target="_blank"><img class="ying" src="file:///D:/img/荧.png" alt="与妖为邻"></a></div></figure>
`;
document.getElementById("logo").innerHTML = logoHtml; // 将内容插入到 #logo 中

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.xdnf.cn/news/1559197.html

如若内容造成侵权/违法违规/事实不符,请联系一条长河网进行投诉反馈,一经查实,立即删除!

相关文章

【计算机方向】IEEE二区宝刊,IF=9.6,2个月秒速接受,备受国人吹捧!

期刊解析 01 期刊信息✦ 期刊名称&#xff1a;IEEE Transactions on Affective Computing 出版商&#xff1a;Institute of Electrical and Electronics Engineers Inc. ISSN&#xff1a;1949-3045 …

重头开始嵌入式第四十七天(硬件 ARM裸机开发 RS232 RS4885 IIC)

目录 一.什么是RS232&#xff1f; 1. 历史背景&#xff1a; 2. 电气特性&#xff1a; 3. 连接器类型&#xff1a; 4. 通信特点&#xff1a; 5. 应用场景&#xff1a; 二.什么是RS485&#xff1f; 1. 电气特性&#xff1a; 2. 通信模式&#xff1a; 3. 传输距离与速率&…

扫描电镜是用来测什么的?

扫描电镜是一种用于对样品进行微观尺度形貌观测和分析的仪器。它能够提供高分辨率的图像&#xff0c;帮助科学家和工程师了解样品的微观结构和特性。 一、扫描电镜的一般测量功能 微观形貌观测 扫描电镜可以清晰地观察到样品表面的微观形貌&#xff0c;如颗粒的形状、大小、…

GC9113:电子锁领域的革新力量

在现代社会&#xff0c;安全与便捷成为人们对生活品质的重要追求。电子锁作为保障家庭和商业安全的关键设备&#xff0c;不断经历着技术的革新与升级。而 GC9113 的出现&#xff0c;为电子锁领域带来了全新的替代选择。 GC9113 以其卓越的性能和独特的优势&#xff0c;在电子锁…

【嵌入式软件-STM32】STM32简介

目录 一、STM32定义 二、STM32用途 三、STM32特点 四、STM32 四个系列 五、了解ARM 六、芯片解释 七、片上资源 八、命名规则 九、系统结构 内核 Flash DMA 外设种类和分布 十、引脚定义 类型 名称 引脚 十一、启动配置 十二、STM32最小系统电路 STM32及供电 供电引脚 滤波电容…

深度学习:循环神经网络RNN

目录 一、神经网络的历程 1.传统神经网络存在的问题 2.提出一种新的神经网络 二、RNN基本结构 1.RNN基本结构 2.RNN的独特结构 3.RNN的局限性 一、神经网络的历程 1.传统神经网络存在的问题 无法训练出具有顺序的数据。模型搭建时没有考虑数据上下之间的关系。因为传统…

十年网络安全工程师谈学习网络安全的正确顺序

当今数字化时代&#xff0c;网络安全行业如守护数字世界的坚固堡垒&#xff0c;其重要性愈发凸显。随着信息技术的迅猛发展&#xff0c;我们的生活、工作、社交等方方面面都与网络紧密相连&#xff0c;从个人隐私信息到企业核心数据&#xff0c;再到国家关键基础设施乃至全球互…

什么是Cookie 它有什么作用 及如何使用Session-Cookie方案进行身份验证 总结

Cookie 和 Session 都是用来跟踪浏览器用户身份的会话方式&#xff0c;但是两者的应用场景不太一样。 维基百科是这样定义 Cookie 的&#xff1a; Cookies 是某些网站为了辨别用户身份而储存在用户本地终端上的数据&#xff08;通常经过加密&#xff09;。 简单来说&#xff1…

实战千问2大模型第五天——VLLM 运行 Qwen2-VL-7B(多模态)

一、简介 VLLM 是一种高效的深度学习推理库&#xff0c;通过PagedAttention算法有效管理大语言模型的注意力内存&#xff0c;其特点包括24倍的吞吐提升和3.5倍的TGI性能&#xff0c;无需修改模型结构&#xff0c;专门设计用于加速大规模语言模型&#xff08;LLM&#xff09;的…

网站排名,让网站快速有排名的几个方法

要让网站快速获得并提升排名&#xff0c;需要综合运用一系列专业策略和技术&#xff0c;这些策略涵盖了内容优化、技术调整、外链建设、用户体验提升等多个方面。以下是让网站快速有排名的几个方法&#xff1a; 1.内容为王&#xff1a;创造高质量、有价值的内容 -深入…

The Android SDK location cannot be at the filesystem root

win11&#xff0c; 安装启动完Android Studio后&#xff0c;一直显示 The Android SDK location cannot be at the filesystem root因此需要下载SDK包&#xff0c;必须开启代理。 开启代理后&#xff0c;在System下开启自动检测代理&#xff0c;如图 重启Android Studio&a…

Ubuntu双卡训练过程中电脑总是突然重启【解决方法】

本来以为是温度过热造成的&#xff0c;发现不是&#xff0c;因为在重启的瞬间&#xff0c;gpu温度并没有特别高。 参见视频如下&#xff1a; 双卡训练过程中gpu温度监测 然后尝试了另一种方法&#xff1a; 限制gpu显卡的功率 具体操作如下&#xff1a; 先检查当前gpu功率限…

[论文阅读] DVQA: Understanding Data Visualizations via Question Answering

原文链接&#xff1a;http://arxiv.org/abs/1801.08163 启发&#xff1a;没太读懂这篇论文&#xff0c;暂时能理解的就是本文提出了一个专门针对条形图问答的数据集DVQA以及一个端到端模型SANDY&#xff0c;模型有两个版本&#xff0c;Oracle和OCR。主要解决的问题是固定词表无…

IPguard vs Ping32:防泄密软件的巅峰对决,哪款是你的理想选择

在当今这个数字化时代&#xff0c;数据安全已成为企业不可忽视的重要议题。为了有效防范数据泄露风险&#xff0c;众多企业开始寻求专业的防泄密软件。IPguard与Ping32作为两款备受关注的防泄密软件&#xff0c;各自以其卓越的性能和独特的功能&#xff0c;赢得了广大用户的青睐…

线程(五)线程的同步和互斥——线程信号量

文章目录 线程线程的同步和互斥线程的同步和互斥--线程信号量示例--使用线程信号量来控制线程执行的先后顺序示例--使用信号量实现线程之间的互斥示例--使用信号量实现线程之间的同步 死锁线程状态转换 线程 线程的同步和互斥 线程的同步和互斥–线程信号量 上边讲了互斥的方…

力扣HOT100合集

力扣HOT100 - 1. 两数之和 解题思路&#xff1a; 解法一&#xff1a;暴力 class Solution {public int[] twoSum(int[] nums, int target) {int n nums.length;for (int i 0; i < n; i)for (int j i 1; j < n; j) {if (target nums[i] nums[j])return new int[] …

操作系统-系统调用

应用程序调用printf(),会触发系统调用write() 1、概念 操作系统服务的编程接口&#xff0c;通常由高级语言编写&#xff08;C/C&#xff09;&#xff0c;程序访问通常是通过高层次的API接口而不是直接进行系统调用。 2、三种最常用的应用程序编程接口&#xff08;API&#xf…

Vue深入了解

Vue深入了解 MVVMv-model (双向数据绑定原理)异步更新keep-alive原理$nextTick原理computed 和 watch 的区别css-scoped虚拟DOMVuex && PiniaVue-router原理proxy 与 Object.defineProperty组件通信方式 MVVM <!DOCTYPE html> <html lang"en">&…

AD原理图编译出现Net XX has no driving source

提示无驱动电压源&#xff0c;这是因为你的芯片管脚设置了电气属性造成的。 两种解决AD中出现Net has no driving source警告的方法。 方法一&#xff1a;取消电气属性检测&#xff0c;但不推荐&#xff1b; 打开原理图编译项&#xff0c;将NET no driving source 修改为no …

PostgreSQL的学习心得和知识总结(一百五十三)|[performance]将 OR 子句转换为 ANY 表达式

目录结构 注&#xff1a;提前言明 本文借鉴了以下博主、书籍或网站的内容&#xff0c;其列表如下&#xff1a; 1、参考书籍&#xff1a;《PostgreSQL数据库内核分析》 2、参考书籍&#xff1a;《数据库事务处理的艺术&#xff1a;事务管理与并发控制》 3、PostgreSQL数据库仓库…