-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdictionary.html
More file actions
99 lines (83 loc) · 2.4 KB
/
Copy pathdictionary.html
File metadata and controls
99 lines (83 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Английский словарь</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
margin: 20px;
}
#dictionary {
width: 80%;
margin: 20px auto;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
th, td {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
th {
background-color: #f2f2f2;
}
button {
margin-top: 20px;
padding: 10px;
cursor: pointer;
}
</style>
</head>
<body>
<h1>Английский словарь</h1>
<div id="dictionary">
<table>
<thead>
<tr>
<th>Слово</th>
<th>Значение</th>
</tr>
</thead>
<tbody>
<tr>
<td>Apple</td>
<td>Яблоко</td>
</tr>
<!-- Добавьте другие строки, соответствующие вашему словарю -->
</tbody>
</table>
</div>
<label for="newWord">Новое слово:</label>
<input type="text" id="newWord" placeholder="Введите новое слово">
<label for="newDefinition">Значение:</label>
<input type="text" id="newDefinition" placeholder="Введите значение">
<button onclick="addWord()">Добавить слово</button>
<script>
function addWord() {
const newWordInput = document.getElementById('newWord');
const newDefinitionInput = document.getElementById('newDefinition');
const word = newWordInput.value;
const definition = newDefinitionInput.value;
if (!word || !definition) {
alert('Введите слово и его значение.');
return;
}
const dictionaryTable = document.querySelector('table tbody');
const newRow = dictionaryTable.insertRow();
const cell1 = newRow.insertCell(0);
const cell2 = newRow.insertCell(1);
cell1.innerHTML = word;
cell2.innerHTML = definition;
// Очистка полей ввода
newWordInput.value = '';
newDefinitionInput.value = '';
}
</script>
</body>
</html>