写个图书管理系统网页
时间: 2023-02-22 21:09:51 浏览: 69
下面是一个简单的图书管理系统的网页版本的代码,使用了 HTML、CSS 和 JavaScript:
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>图书管理系统</title>
<style>
table {
width: 100%;
border-collapse: collapse;
}
th, td {
border: 1px solid black;
padding: 8px;
text-align: left;
}
th {
background-color: lightgray;
}
input[type="text"], select {
width: 100%;
padding: 12px;
border: 1px solid lightgray;
border-radius: 4px;
box-sizing: border-box;
margin-top: 6px;
margin-bottom: 16px;
resize: vertical;
}
input[type="submit"] {
background-color: lightblue;
color: white;
padding: 12px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
}
input[type="submit"]:hover {
background-color: blue;
}
.form {
background-color: white;
padding: 20px;
border-radius: 5px;
width: 50%;
box-sizing: border-box;
margin: 20px auto;
text-align: center;
}
.form h2 {
margin-top: 0;
}
</style>
</head>
<body>
<div class="form">
<h2>添加图书</h2>
<form id="add-book-form">
<input type="text" id="name" placeholder="图书名称" required>
<input type="text" id="author" placeholder="作者" required>
<input type="text" id="isbn" placeholder="ISBN" required>
<select id="category">
<option value="科技">科技</option>
<option value="历史">历史</option>
<option value="文学">文学</option>
</select>
<input type="submit" value="添加">
</form>
</div>
<table id="book-table">
<tr>
<th>图书名称</th>
<th>作者</th>
<th>ISBN</th>
<th>分类</th>
<th>操作</th>
</tr>
</table>
<script>
const form = document.querySelector("#add-book-form");
form