<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dynamic Data Table</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
box-sizing: border-box;
background-color: #f0f2f5;
}
.container {
max-width: 800px;
margin: 50px auto;
padding: 20px;
background-color: white;
border-radius: 8px;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
table {
width: 100%;
border-collapse: collapse;
margin: 20px 0;
}
th, td {
padding: 12px;
text-align: left;
border-bottom: 1px solid #ddd;
}
th {
background-color: #007bff;
color: white;
}
tr:hover {
background-color: #f1f1f1;
}
</style>
</head>
<body>
<div class="container">
<h1>Dynamic Data Table</h1>
<button onclick="addRow()">Add Row</button>
<table id="dataTable">
<thead>
<tr>
<th>Name</th>
<th>Age</th>
<th>Email</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<script>
function addRow() {
const table = document.getElementById('dataTable').getElementsByTagName('tbody')[0];
const row = table.insertRow();
const nameCell = row.insertCell(0);
const ageCell = row.insertCell(1);
const emailCell = row.insertCell(2);
nameCell.textContent = 'John Doe';
ageCell.textContent = '30';
emailCell.textContent = 'john.doe@example.com';
}
</script>
</body>
</html>
动态数据表格
原创mb64cc5144d532c ©著作权
©著作权归作者所有:来自51CTO博客作者mb64cc5144d532c的原创作品,请联系作者获取转载授权,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
记录flink sql实时同步mysql数据表到mysql
关于大数据实时数据同步flink部分测试实验
flink mysql bc -
QTableWidget数据表格
void setRowHeight(int ...
数据 i++ JAVA