File manager - Edit - /home/webapp68.cm.in.th/u68319090024/final/news/manage_categories.html
Back
<!DOCTYPE html> <html lang="th"> <head> <meta charset="UTF-8"> <title>จัดการหมวดหมู่</title> <style> body { font-family: Arial; margin:20px; background:#f4f4f4; } h1 { text-align:center; color:#333; } table { width:50%; margin:20px auto; border-collapse: collapse; background:#fff; } th, td { padding:10px; border:1px solid #ccc; text-align:center; } th { background:#007BFF; color:#fff; } button { padding:5px 10px; border:none; border-radius:5px; cursor:pointer; margin:2px; } .add { background:#28a745; color:#fff; } .edit { background:#ffc107; color:#fff; } .delete { background:#dc3545; color:#fff; } a { display:block; text-align:center; margin-top:20px; text-decoration:none; color:#007BFF; } </style> </head> <body> <h1>จัดการหมวดหมู่</h1> <button class="add" onclick="addCategory()">เพิ่มหมวดหมู่</button> <table id="categoryTable"> <tr><th>ID</th><th>ชื่อหมวดหมู่</th><th>Actions</th></tr> </table> <a href="index.html">กลับไป Dashboard</a> <script> let categories = window.opener.dataStore.categories; function renderCategories(){ let table = document.getElementById("categoryTable"); table.innerHTML = '<tr><th>ID</th><th>ชื่อหมวดหมู่</th><th>Actions</th></tr>'; categories.forEach((c,i)=>{ let row = table.insertRow(); row.insertCell(0).innerText = i+1; row.insertCell(1).innerText = c; row.insertCell(2).innerHTML = `<button class="edit" onclick="editCategory(${i})">แก้ไข</button> <button class="delete" onclick="deleteCategory(${i})">ลบ</button>`; }); } function addCategory(){ let name = prompt("ชื่อหมวดหมู่:"); if(!name) return; categories.push(name); renderCategories(); } function editCategory(index){ let name = prompt("แก้ไขชื่อหมวดหมู่:", categories[index]); if(name) categories[index] = name; renderCategories(); } function deleteCategory(index){ if(confirm("คุณต้องการลบหมวดหมู่นี้หรือไม่?")){ categories.splice(index,1); renderCategories(); } } renderCategories(); </script> </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.44 |
proxy
|
phpinfo
|
Settings