⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.124
Server IP:
50.28.103.30
Server:
Linux host.jcukjv-lwsites.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
Server Software:
nginx/1.28.0
PHP Version:
8.3.12
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
www
/
wwwroot
/
ef.electronharmony.com
/
1
/
T8
/
View File Name :
index.html
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>简易增删改查</title> </head> <body> <h2>用户管理</h2> <input id="name" placeholder="输入姓名"> <button onclick="add()">添加</button> <ul id="list"></ul> <script> const key = 'users'; function getData() { return JSON.parse(localStorage.getItem(key) || '[]'); } function saveData(data) { localStorage.setItem(key, JSON.stringify(data)); } function render() { const list = document.getElementById('list'); const data = getData(); list.innerHTML = ''; data.forEach((item, i) => { list.innerHTML += ` <li> ${item} <button onclick="edit(${i})">改</button> <button onclick="del(${i})">删</button> </li>`; }); } function add() { const input = document.getElementById('name'); const name = input.value.trim(); if (name) { const data = getData(); data.push(name); saveData(data); input.value = ''; render(); } } function edit(index) { const data = getData(); const newName = prompt('修改姓名:', data[index]); if (newName) { data[index] = newName.trim(); saveData(data); render(); } } function del(index) { const data = getData(); data.splice(index, 1); saveData(data); render(); } render(); </script> </body> </html>