<!DOCTYPE html><html lang="th"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Document Tracker</title> <script defer> let documents = [];function renderTable() { const tableBody = document.getElementById("doc-table-body"); tableBody.innerHTML = ""; documents.forEach((doc, index) => { tableBody.innerHTML += ` <tr> <td>${doc.code}</td> <td>${doc.title}</td> <td>${doc.holder}</td> <td>${doc.location}</td> <td>${doc.note}</td> <td><button onclick="editDoc(${index})">แก้ไข</button></td> </tr> `; }); } function addDocument(event) { event.preventDefault(); const form = event.target; const newDoc = { code: form.code.value, title: form.title.value, holder: form.holder.value, location: form.location.value, note: form.note.value, }; const index = form.index.value; if (index === "") { documents.push(newDoc); } else { documents[index] = newDoc; } form.index.value = ""; renderTable(); } function editDoc(index) { const doc = documents[index]; const form = document.getElementById("doc-form"); form.index.value = index; form.code.value = doc.code; form.title.value = doc.title; form.holder.value = doc.holder; form.location.value = doc.location; form.note.value = doc.note; window.scrollTo(0, 0); } </script> <style> body { font-family: sans-serif; padding: 1rem; max-width: 600px; margin: auto; } input, button, textarea { width: 100%; padding: 0.5rem; margin-top: 0.25rem; margin-bottom: 0.75rem; } table { width: 100%; border-collapse: collapse; margin-top: 2rem; } th, td { border: 1px solid #ccc; padding: 0.5rem; text-align: left; } button { cursor: pointer; background: #4CAF50; color: white; border: none; } button:hover { background: #45a049; } </style> </head> <body> <h1>ระบบติดตามเอกสาร</h1> <form id="doc-form" onsubmit="addDocument
Standard input is empty
<!DOCTYPE html><html lang="th">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document Tracker</title>
<script defer>
let documents = [];function renderTable() {
const tableBody = document.getElementById("doc-table-body");
tableBody.innerHTML = "";
documents.forEach((doc, index) => {
tableBody.innerHTML += `
<tr>
<td>${doc.code}</td>
<td>${doc.title}</td>
<td>${doc.holder}</td>
<td>${doc.location}</td>
<td>${doc.note}</td>
<td><button onclick="editDoc(${index})">แก้ไข</button></td>
</tr>
`;
});
}
function addDocument(event) {
event.preventDefault();
const form = event.target;
const newDoc = {
code: form.code.value,
title: form.title.value,
holder: form.holder.value,
location: form.location.value,
note: form.note.value,
};
const index = form.index.value;
if (index === "") {
documents.push(newDoc);
} else {
documents[index] = newDoc;
}
form.reset();
form.index.value = "";
renderTable();
}
function editDoc(index) {
const doc = documents[index];
const form = document.getElementById("doc-form");
form.index.value = index;
form.code.value = doc.code;
form.title.value = doc.title;
form.holder.value = doc.holder;
form.location.value = doc.location;
form.note.value = doc.note;
window.scrollTo(0, 0);
}
</script>
<style>
body { font-family: sans-serif; padding: 1rem; max-width: 600px; margin: auto; }
input, button, textarea { width: 100%; padding: 0.5rem; margin-top: 0.25rem; margin-bottom: 0.75rem; }
table { width: 100%; border-collapse: collapse; margin-top: 2rem; }
th, td { border: 1px solid #ccc; padding: 0.5rem; text-align: left; }
button { cursor: pointer; background: #4CAF50; color: white; border: none; }
button:hover { background: #45a049; }
</style>
</head>
<body>
<h1>ระบบติดตามเอกสาร</h1>
<form id="doc-form" onsubmit="addDocument