首页 > 其他分享 >备忘录

备忘录

时间:2023-06-30 16:46:21浏览次数:28  
标签:item color todo li 备忘录 5px border

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Todo List</title>
<style>
body {
background-color: #f6f6f6;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
margin: 0;
padding: 0;
}

.container {
max-width: 600px;
margin: 20px auto;
background-color: #fff;
border-radius: 10px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
padding: 20px;
}

.header {
text-align: center;
margin-bottom: 20px;
color: #3f51b5;
}

.todo-form {
display: flex;
align-items: center;
margin-bottom: 20px;
}

.todo-input {
flex: 1;
padding: 10px;
border: none;
border-radius: 5px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.todo-button {
padding: 10px 20px;
border: none;
border-radius: 5px;
background-color: #3f51b5;
color: #fff;
cursor: pointer;
}

.todo-list {
list-style: none;
padding: 0;
}

.todo-item {
display: flex;
align-items: center;
padding: 10px;
border-radius: 5px;
margin-bottom: 10px;
background-color: #e8e8e8;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.todo-item:last-child {
margin-bottom: 0;
}

.todo-item-checkbox {
margin-right: 10px;
}

.todo-item-text {
flex: 1;
color: #3f51b5;
font-weight: bold;
}

.todo-item-delete {
padding: 5px 10px;
border: none;
border-radius: 5px;
background-color: #ff6b6b;
color: #fff;
cursor: pointer;
transition: background-color 0.3s;
}

.todo-item-delete:hover {
background-color: #ff4f4f;
}
</style>
</head>
<body>
<div class="container">
<h1 class="header">Todo List</h1>
<form class="todo-form" id="todoForm">
<input type="text" class="todo-input" placeholder="Add a new todo" id="todoInput">
<button type="submit" class="todo-button">Add</button>
</form>
<ul class="todo-list" id="todoList"></ul>
</div>
</body>
</html>
<script>
const toDoForm = document.getElementById('todoForm')
const toDoList = document.getElementById('todoList')
const toDoInput = document.getElementById('todoInput')

function creatTodoItem(text){
const li=document.createElement('li')
li.className="todo-item"
li.innerHTML=`
<input type="checkbox" class="todo-item-checkbox">
<span class="todo-item-text">${text}</span>
<button class="todo-item-delete">Delete </button>
`
return li
}

toDoForm.onsubmit=function (event) {
event.preventDefault()//onsubmit事件应该跳转新网页,用这个取消默认跳转
const todoText=toDoInput.value
if (!todoText)return
const li= creatTodoItem(toDoInput.value.trim())//trim去掉字符串头尾的空格
toDoList.appendChild(li)//把生成的li放到ul里面去nn
toDoInput.value=""
}

todoList.onclick = function (event) {
if (event.target.className === "todo-item-delete" && confirm('Are you sure you want to delete this todo?'))
event.target.parentNode.remove()
}

</script>

标签:item,color,todo,li,备忘录,5px,border
From: https://www.cnblogs.com/kun030729/p/17517194.html

相关文章

  • 20230426 18. 备忘录模式 - 游戏人物
    介绍备忘录(Memento):在不破坏封装性的前提下,捕获一个对象的内部状态,并在该对象之外保存这个状态。这样以后就可将该对象恢复到原先保存的状态。Originator(发起人):负责创建一个备忘录Memento,用以记录当前时刻它的内部状态,并可使用备忘录恢复内部状态。Originator可根据需要决定M......
  • Python设计模式-19-备忘录模式
    备忘录模式是一种行为型设计模式,它允许我们在不破坏封装性的前提下,捕获一个对象的内部状态,并在该对象之外保存这个状态。备忘录模式通常包括以下几个角色:发起人(Originator):定义了一个接口,用于创建备忘录对象和恢复对象状态。备忘录(Memento):存储发起人对象的内部状态。管理......
  • 集群变更备忘录
    HDPyum变更之前搭的镜像虚拟机不想启动了,但是yum命令会报错,把之前配置的文件删了mkdir/etc/yum.repos.d.bakcd/etc/yum.repos.dmvambari-hdp-51.repoambari.repoHDF.repoHDP.repoHDP-UTILS.repo/etc/yum.repos.d.bak/yumcleanallyummakecache......
  • 内网攻防技术备忘录
    内网攻防技术备忘录0x01信息搜集Copy#nmap扫描实时存活的ipnmap10.1.1.1--open-oGscan-results;catscan-results|grep"/open"|cut-d""-f2>exposed-services-ips1.1常用命令Copyarp-arouteprint获取arp表curlvps:8080http连通性nslookupwww.bai......
  • 常用sql语句备忘录,不定时更新
    1updatetab_userssetPhoneNum=REPLACE(PhoneNum,CHAR(13),'')--去除回车符2updatetab_userssetPhoneNum=REPLACE(PhoneNum,CHAR(10),'')--去除换行符3updatetab_userssetPhoneNum=REPLACE(PhoneNum,CHAR(9),'')--去除tab制表符4updatetab_use......
  • 备忘录模式:保存对象状态
    备忘录模式是一种行为型设计模式,用于保存对象的状态,以便在需要时恢复该状态。它通常用于撤销操作或回滚事务。示例代码//被保存状态的对象classOriginator{privateStringstate;publicvoidsetState(Stringstate){this.state=state;}......
  • SQL备忘录
    资料来源零基础33分钟学会4种数据的SQL语言|bilibli|SQL优化SQL内容|cnblogs|我没有bugSQL教程基础知识SQL是用于存储和管理关系数据库中的数据的标准计算机语言不区分大小写,几乎所有的关系数据库都通用数据类型SQLServerOracleMySQLPostgreSQL布尔......
  • vue3+vant4+vuex4实现todolist备忘录案例
    案例图片如下:  1<van-cell-group>2<van-cell>3<van-row>4<van-colspan="20">5<van-field6:value="content"7@change="handl......
  • mysql备忘录
    MySQL8下载安装腾讯云Ubuntu20.04服务器下载MySQL8并开启远程服务下载sudoaptupdate#更新Ubuntu存储库sudoaptinstallmysql-server#下载mysqlsudosystemctlstatusmysql#查看mysql状态配置启动找到mysqld文件路径find/-namemysql.server或find/-namemy......
  • Linux命令备忘录
    常用命令源链接地址线上查询及帮助命令(2个)man查看命令帮助,命令的词典,更复杂的还有info,但不常用。help查看Linux内置命令的帮助,比如cd命令。文件和目录操作命令(18个)ls全拼list,功能是列出目录的内容及其内容属性信息。cd全拼changedirectory,功......