第13次修改了可删除可持久保存的前端html备忘录:删除按钮靠右,做了一个背景主题:现代深色

第13次修改了可删除可持久保存的前端html备忘录:删除按钮靠右,做了一个背景主题:现代深色

 

备忘录代码

<!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>
        .finish {
            /* 删除线 
              text-decoration: line-through; */
            /* 下划线 */
            text-decoration: underline;
            text-decoration-color: rgb(255, 0, 0);
            background-color: rgb(220, 226, 241);
            color: rgb(253, 250, 250);
            text-shadow: 1px 1px 1px #030303;
            box-shadow:
                inset -2px -2px 3px rgba(255, 255, 255, 0.6),
                inset 2px 2px 3px rgba(0, 0, 0, 0.6);
        }
        textarea {
            font-size: 20px;
            &::placeholder {
                color: rgb(248, 0, 0);
                font-size: 12px;
            }
        }
        h1 {
            text-indent: 10em;
            /* 行高
         */
            line-height: 2em;
        }
        sub {
            /* 外边距: 上右下左 */
            margin: 0px 40px 0px 20px;
        }
        .down-div {
            text-indent: 2em;
        }
        .delete {
            color: #ff0101;
            /* 靠右 */
         float: right;
        }
    </style>
</head>
<body>
    <div class="h1-div">
        <h1>
            备忘录
            <dfn>(memorandum)</dfn>
        </h1>
    </div>
    <div class="up-div">
        <input type="file" name="inputfile" accept="text/plain, text/css, text/html, text/javascript, text/markdown"
            class="background3D" />
        <textarea class="up-textarea" name="uptextarea" rows="1" cols="30%"
            placeholder="请选择txt、js、css或html文件,文件内容会被自动读取"></textarea>
        <button type="text" class="up-button">添加</button>
        <button id="openButton">打开URL</button>
        <button class="a-href"><a href="https://www.baidu.com/s" target="_blank">百度一下</a></button>
        <button id="up-button1" class="delete">对选择的进行删除</button>
        <p>
            <sub>
                护眼背景 &amp;lt;style&amp;gt;
                body { background-color: rgb(110, 123, 108); color: #fff; text-shadow: 1px 1px 1px #000000; }
                &amp;lt;/style&amp;gt;
            </sub>
            <sub> &lt;button class="a-href"&gt;
                &lt;a href="输入网站地址" target="_blank"&gt;
                输入网站名称
                &lt;/a&gt; &lt;/button&gt;
            </sub>
        </p>
    </div>
    <hr>
    <div class="down-div">
    </div>
    <script>
        var uptext = document.querySelector(".up-textarea");
        var addto = document.querySelector(".up-button");
        var text = document.querySelector(".down-div");
        /*************添加事件*****************/
        addto.onclick = function () {
            inserhtml(uptext.value, '');
            // 添加后清空输入框
            uptext.value = '';
            // 焦点放回输入框
            uptext.focus();
            savetodo();
        }
        /*************savetodo函数****************/
        var savetodo = function () {
            let todoarr = [];
            let todojs = {};
            var econtent = document.querySelectorAll('.content');
            for (let index = 0; index < econtent.length; index++) {
                todojs.name = econtent[index].innerHTML;
                todojs.finish = econtent[index].classList.contains('finish');
                todoarr.push(todojs);
                todojs = {};
            }
            save(todoarr);
        }
        var loadtodo = function () {
            let todoarr = load();
            for (let index = 0; index < todoarr.length; index++) {
                inserhtml(todoarr[index].name, todoarr[index].finish ? 'finish' : '');
            }
        }
        /**********************本地持久储存(localStorage)函数*****************************/
        var save = function (arr) {
            /**JSON.stringify(arr) 先将数组转换为字符串   
             *localStorage.todos 然后将字符串保存到本地的todos中*/
            localStorage.todos = JSON.stringify(arr);
        }
        /**
         *读取函数,把todos转成数组
         *然后返回数组*/
        var load = function (arr) {
            var arr = JSON.parse(localStorage.todos);
            return arr;
        }
        /**********************finish样式函数*****************************/
        /**********************按钮点击事件*****************************/
        text.onclick = function () {
            var tg = event.target;
            // 获取父元素下的所有子元素
            var tgkids = tg.parentElement.children;
            /*******************************对复选框的点击事件******************************/
            if (tgkids[0].checked) {
                tgkids[1].classList.add("finish");
            }
            else {
                tgkids[1].classList.remove("finish");
            }
            // 保存更改的样式
            savetodo();
            /*******************************对选择的进行删除********************************************/
            var Select = document.getElementById("up-button1");
            Select.onclick = function () {
                if (confirm("是否删除所选?")) {
                    var check = document.getElementsByName("checkbox");
                    for (var i = 0; i < check.length; i++) {
                        if (check[i].checked) {
                            check[i].parentElement.remove();
                            i--;
                            // 删除后保存
                            savetodo();
                        }
                    }
                }
            }
        }
        var inserhtml = function (val, cls) {
            text.insertAdjacentHTML("beforeend",
                `<div>
                    <input  type="checkbox" name='checkbox'>               
                    <span class='content ${cls}'>${val}</span>   
                </div>`
            )
        }
        loadtodo();
        /*****************************提示弹窗无需点击的函数**********************************************/
        function displayAlert(type, data, time) {
            var prompt = document.createElement("div");
            if (type == "success") {
                prompt.style.width = "200px";
                prompt.style.backgroundColor = "#009900";
            } else if (type == "error") {
                prompt.style.width = "280px";
                prompt.style.backgroundColor = "#990000";
            } else if (type == "info") {
                prompt.style.backgroundColor = " #e6b800";
                prompt.style.width = "600px";
            } else {
                return;
            }
            prompt.id = "prompt";
            prompt.style.textAlign = "center";
            prompt.style.position = "absolute";
            prompt.style.height = "60px";
            prompt.style.marginLeft = "-100px";
            prompt.style.marginTop = "-30px";
            prompt.style.left = "30%";
            prompt.style.top = "5%";
            prompt.style.color = "white";
            prompt.style.fontSize = "25px";
            prompt.style.borderRadius = "20px";
            prompt.style.textAlign = "center";
            prompt.style.lineHeight = "60px";
            if (document.getElementById("") == null) {
                document.body.appendChild(prompt);
                prompt.innerHTML = data;
                setTimeout(function () {
                    document.body.removeChild(prompt);
                }, time);
            }
        }
        /**************************打开URL按钮的JavaScript******************************************/
        // 获取打开URL按钮元素
        var openBtn = document.getElementById("openButton");
        // 添加点击事件处理程序
        openBtn.addEventListener('click', function () {
            // 获取文件路径
            // 这里假设您已经有一个函数来获取文件路径,例如 prompt('请输入文件路径', 'D:/前端学习', '_blank');
            var filePath = prompt("请输入网站地址或者本地文件路径", "D:/备忘录信息");
            if (filePath) {
                // 使用window.location对象的assign()方法导航到指定文件
                // window.location.assign(filePath);
                // 或者使用window.open()方法打开新窗口导航到指定文件
                window.open(filePath);
            } else {
                displayAlert('info', '未提供有效的文件路径!', 1500);
                // alert("未提供有效的文件路径!");
            }
        });
        /**************************本地文件读取的函数******************************************/
        window.onload = function () {
            var text = document.getElementsByName('uptextarea')[0],
                inputFile = document.getElementsByName('inputfile')[0];
            //上传文件
            inputFile.onchange = function () {
                console.log(this.files);
                var reader = new FileReader();
                reader.readAsText(this.files[0], 'UTF-8');
                reader.onload = function (e) {
                    // urlData就是对应的文件内容
                    var urlData = this.result;
                    text.value = urlData;
                };
            };
        };
    </script>
</body>
</html>

 背景主题:现代深色

 

<!DOCTYPE html>
<html lang="zh">
<a class="a-href a-h">备忘录的背景主题:现代深色</a>
<style>
    * {
        /* 外边距: 上右下左 */
        margin: 0px 0px 0px 0px;
        /* 内边距: 上右下左 */
        padding: 0 0 0 0;
        /* 文本颜色 */
        color: #75a8c6;
    }
    body {
        background-color: #2b2b2b;
    }
    /* 鼠标变小手 */
    input,
    button {
        cursor: pointer;
    }
    /* ***********************h1-div区************************************* */
    /* 3D立体文本的样式 */
    .h1-div {
        background: linear-gradient(0.25turn, rgb(110, 123, 108), rgb(204, 232, 207), #f7d6d6);
        h1 {
            color: #f7d6d6;
            text-shadow: 0px 1px 0px #999,
                0px 2px 0px #888,
                0px 3px 0px #777,
                0px 4px 0px #666,
                0px 5px 0px #555,
                0px 6px 0px #444,
                0px 7px 0px #333,
                0px 8px 7px #001135
        }
    }
    /* **********************up-div区************************************** */
    .up-div {
        /* 圆角 */
        border-radius: 10px;
        input[type="file"] {
            width: 200px;
        }
        textarea {
            line-height: 1.5em;
            /* background-color: rgb(227, 237, 205); */
            background: #303745;
            text-shadow: 1px 1px 1px #000;
            /* text-decoration: underline;
            text-decoration-color: rgb(184, 229, 184); */
            &::placeholder {
                color: #75a8c6;
                text-shadow: 1px 1px 1px #000000;
            }
        }
        p {
            background-color: rgb(199, 237, 204);
            sub {
                text-shadow: 1px 1px 1px #030303;
                box-shadow: inset -2px -2px 3px rgba(255, 255, 255, 0.6),
                    inset 2px 2px 3px rgba(0, 0, 0, 0.6);
            }
            sub:nth-child(1) {
                background-color: rgb(233, 235, 254);
            }
            sub+sub {
                background-color: rgb(227, 237, 205);
            }
        }
    }
    /* 3D背景的样式 */
    .a-href,
    #prompt,
    button,
    input {
        line-height: 35px;
        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 4px 4px 4px rgba(255, 255, 255, 0.6),
            inset -4px -4px 5px rgba(0, 0, 0, 0.6);
        border-radius: 10px;
        text-shadow: 1px 1px 1px #000;
        border: 0px solid black;
        font-size: 20px;
        padding: 0 10px;
        text-align: center;
        cursor: pointer;
    }
    a {
        color: green;
        /* 下划线 */
        text-decoration: underline;
        text-decoration-color: green;
        text-shadow: 2px 2px 1px #000;
    }
    .a-h{
        color: #8cd571;
    }
    /* 背景颜色 */
    .up-div {
        background-color: #1c1c1c;
    }
    input[type="file"],
    .up-button {
        background-color: #48603f;
    }
    button {
        background-color: #b8815d;
    }
    button:hover,
    input:hover {
        background-color: rgb(255, 2, 2);
    }
    /* 按钮凹进去的样式 */
    button:active,
    input:active {
        box-shadow: inset -2px -2px 3px rgba(255, 255, 255, 0.6),
            inset 2px 2px 3px rgba(0, 0, 0, 0.6);
    }
    /* ***********************down-div************************************* */
    .down-div {
        text-indent: 5em;
        /* background: linear-gradient(0.25turn, #b7efea82, #cacf80ac, #f7d6d6); */
        background: #303745;
        /* 设置复选框样式*/
        input[type="checkbox"] {
            background-color: #b8815d;
            -webkit-appearance: none;
            appearance: none;
            width: 25px;
            height: 25px;
            position: relative;
            margin-right: 10px;
            border-radius: 50%;
        }
        input[type="checkbox"]::after {
            content: "";
            width: 100%;
            height: 100%;
            border: 2px solid #e9f504;
            position: absolute;
            left: -3px;
            top: -3px;
            border-radius: 50%;
        }
        /* 设置复选框点击之后的样式*/
        input[type="checkbox"]:checked::after {
            height: 15px;
            width: 25px;
            border-top: none;
            border-right: none;
            border-radius: 0;
            transform: rotate(-45deg);
            transition: all 0.5s ease-in-out;
        }
        span {
            /* background-color: #515e6f; */
            text-shadow: 1px 1px 1px #000000;
            box-shadow:
                inset -2px -2px 3px rgba(255, 255, 255, 0.6),
                inset 2px 2px 3px rgba(0, 0, 0, 0.6);
        }
    }
    .finish {
        /* 删除线 */
        /* text-decoration: line-through;  */
        /* 下划线 */
        text-decoration: underline;
        text-decoration-color: rgb(255, 0, 0);
        background-color: rgb(220, 226, 241);
        color: rgb(253, 250, 250);
        text-shadow: 1px 1px 1px #030303;
        box-shadow:
            inset -2px -2px 3px rgba(255, 255, 255, 0.6),
            inset 2px 2px 3px rgba(0, 0, 0, 0.6);
    }
    .a-href {
        line-height: 25px;
        background-color: #515e6f;
    }
</style>
</html>

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

LFU算法

LFU算法 Least Frequently Used&#xff08;最不频繁使用&#xff09; Leetcode有原题&#xff0c;之前手写过LRU&#xff0c;数据结构还是习惯于用java实现&#xff0c;实现是copy的评论题解。 题解注释写的很清楚 大致就是说LFUCache类维护一个存放node的map&#xff0c;同…

立创EDA学习:设计收尾工作

布线整理 ShiftM&#xff0c;关闭铺铜显示 调整结束后再使用快捷键”ShiftM“打开铺铜 过孔 在空白区域加上一些GND过孔&#xff0c;连接顶层与底层的铺铜。放置好”过孔“后&#xff0c;隐藏铺铜&#xff0c;观察刚才放置的过孔有没有妨碍到其他器件 调整铺铜 先打开铺铜区&…

php mysql字段默认值使用问题

前提是使用了事务&#xff0c;在第一个阶段 是A表操作保存&#xff0c;第二阶段操作B表&#xff0c;操作B表的时候使用了A表的一个字段&#xff0c;这个字段在第一阶段没有设置值&#xff0c;保存的时候使用字段默认值。 【这种情况 最好是在第一阶段 把后面要使用的字段设置好…

C#在图片上输出文字和保存

winform&#xff0c;图片控件&#xff0c;加载一个图片&#xff0c;在图片上输出文字&#xff1b; 输出文字的代码如下&#xff1b; private void pictureBox1_Paint(object sender, PaintEventArgs e){Graphics g1 e.Graphics;g1.DrawString("测试", this.Font, B…

物联网IOT视频设备如何快速对接阿里云生活物联网(Link Visual)并成功上云?

原文永久更新地址&#xff1a;https://www.yundashi168.com/472.html 文章来源&#xff1a;猿视野 如果有图片看不清楚&#xff0c;加载不出来&#xff0c;请阅读原文。 什么是Link Visual、 Link Visual是生活物联网平台针对视频产品推出的增值服务&#xff0c;提供视频数据上…

指针的深入理解1

1.如何理解指针 假设有一栋宿舍楼&#xff0c;把你放在楼里&#xff0c;楼上有100个房间&#xff0c;但是房间没有编号&#xff0c;你的一个朋友来找你玩&#xff0c; 如果想找到你&#xff0c;就得挨个房子去找&#xff0c;这样效率很低&#xff0c;但是我们如果根据楼层和楼…

C#,恩廷格尔组合数(Entringer Number)的算法与源程序

恩廷格尔组合数&#xff08;Entringer Number&#xff09;组合数学的序列数字之一。 E&#xff08;n&#xff0c;k&#xff09;是{1&#xff0c;2&#xff0c;…&#xff0c;n1}的排列数&#xff0c;从k1开始&#xff0c;先下降后上升。 计算结果&#xff1a; 源代码&#xf…

用Excel辅助做数独

做数独游戏的时候&#xff0c;画在纸上很容易弄花眼&#xff0c;所以我考虑用Excel辅助做一个。 界面如下&#xff1a; 按下初始化表格区域按钮&#xff0c;会在所有单元格中填充“123456789”。如下图&#xff1a; 当某个单元格删除得只剩一个数字时&#xff0c;会将同一行、…

[UI5 常用控件] 03.Icon, Avatar,Image

文章目录 前言1. Icon2. Avatar2.1 displayShape2.2 initials2.3 backgroundColor2.4 Size2.5 fallbackIcon2.6 badgeIcon2.7 badgeValueState2.8 active 3. Image 前言 本章节记录常用控件Title,Link,Label。 其路径分别是&#xff1a; sap.m.Iconsap.m.Avatarsap.m.Image 1…

C++面试:散列表

目录 1. 散列表的基本概念 散列表的定义 散列函数 哈希冲突 2. 处理冲突的方法 链地址法&#xff08;Separate Chaining&#xff09; 开放地址法 再散列 3. 散列表的性能分析 1. 平均查找长度&#xff08;ASL&#xff09; 2. 负载因子&#xff08;Load Factor&#…

CAD-autolisp(二)——选择集、命令行设置对话框、符号表

目录 一、选择集1.1 选择集的创建1.2 选择集的编辑1.3 操作选择集 二、命令行设置对话框2.1 设置图层2.2 加载线型2.3 设置字体样式2.4 设置标注样式&#xff08;了解即可&#xff09; 三、符号表3.1 简介3.2 符号表查找3.2 符号表删改增 一、选择集 定义&#xff1a;批量选择…

go语言(十八)---- goroutine

一、goroutine package mainimport ("fmt""time" )func main() {//用go创建承载一个形参为空&#xff0c;返回值为空的一个函数go func() {defer fmt.Println("A.defer")func() {defer fmt.Println("B.defer")//退出当前goroutinefmt…

《WebKit 技术内幕》学习之十五(6):Web前端的未来

6 Chromium OS和Chrome的Web应用 6.1 基本原理 HTML5技术已经不仅仅用来编写网页了&#xff0c;也可以用来实现Web应用。传统的操作系统支持本地应用&#xff0c;那么是否可以有专门的操作系统来支持Web应用呢&#xff1f;当然&#xff0c;现在已经有众多基于Web的操作系统&…

跟无神学AI之Prompt

在大模型时代会写prompt变得很重要。 Prompt翻译为中文为提示词&#xff0c;在大模型的特定领域指的是大模型使用者给大模型提交的一种有一定格式的交互命令&#xff0c;让我们看看科大讯飞的大模型给出的答案—— Prompt是一种向人工智能模型提供的输入文本或指令&#xff0…

uv胶UV大灯修复液修复汽车车灯大灯尾灯?

使用UV胶进行汽车大灯修复是一种常见的方法&#xff0c;特别是用于修复裂纹、划痕或氧化的透明塑料表面。以下是使用UV胶修复汽车大灯的一般步骤&#xff1a; 1.准备工作&#xff1a; 确保汽车大灯表面是干净的&#xff0c;没有灰尘、油脂或其他污垢。可以使用清洁剂和软布进行…

Microsoft Remote Desktop for Mac(远程桌面连接)激活版

Microsoft Remote Desktop是一款由微软开发的远程桌面连接工具&#xff0c;它允许用户从另一台计算机或移动设备远程连接到Windows桌面或服务器。 以下是该软件的一些主要特点和功能&#xff1a; 跨平台支持&#xff1a;Microsoft Remote Desktop支持Windows、macOS、iOS和Andr…

leetcode:二叉树的中序遍历(外加先序,后序遍历)

题外&#xff1a;另外三种遍历可以看这&#xff1a; 层序遍历&#xff1a; Leetcode:二分搜索树层次遍历-CSDN博客 先序遍历&#xff1a; 二叉树的先序&#xff0c;中序&#xff0c;后序遍历-CSDN博客 后序遍历&#xff1a; 二叉树的先序&#xff0c;中序&#xff0c;后序…

网络安全全栈培训笔记(58-服务攻防-应用协议设备KibanaZabbix远控向日葵VNCTV)

第58天 服务攻防-应用协议&设备Kibana&Zabbix&远控向日葵&VNC&TV 知识点&#xff1a; 1、远程控制第三方应用安全 2、三方应用-向日葵&VNC&TV 3、设备平台-Zabbix&Kibanai漏洞 章节内容&#xff1a; 常见版务应用的安全测试&#xff1a; 1…

【Web】CTFSHOW SQL注入刷题记录(上)

目录 无过滤注入 web171 web172 web173 web174 web175 时间盲注 写马 过滤注入 web176 web177 web178 web179 web180 web181-182 web183 web184 web185-186 web187 web188 web189 web190 布尔盲注 web191 web192 web193 web194 堆叠注入 web195 …

[C++]使用纯opencv部署yolov8旋转框目标检测

【官方框架地址】 https://github.com/ultralytics/ultralytics 【算法介绍】 YOLOv8是一种先进的对象检测算法&#xff0c;它通过单个神经网络实现了快速的物体检测。其中&#xff0c;旋转框检测是YOLOv8的一项重要特性&#xff0c;它可以有效地检测出不同方向和角度的物体。…