-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.html
More file actions
127 lines (107 loc) · 3.32 KB
/
Main.html
File metadata and controls
127 lines (107 loc) · 3.32 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<html>
<head>
<meta charset="UTF-8">
<style>
body {
background: #0d0d0d;
color: #e6e6e6;
font-family: Consolas, "Courier New", monospace;
zoom: 1.8;
padding: 20px;
}
table {
border-collapse: collapse;
margin-top: 20px;
width: 100%;
}
td {
padding: 10px 0;
}
input[type="number"] {
background: #1a1a1a;
border: 1px solid #333;
color: #00ff9d;
padding: 5px 10px;
width: 120px;
font-size: 16px;
border-radius: 4px;
}
button {
background: #111;
border: 1px solid #00ff9d;
color: #00ff9d;
padding: 8px 14px;
font-size: 16px;
cursor: pointer;
border-radius: 4px;
transition: 0.2s;
}
button:hover {
background: #00ff9d;
color: #111;
}
#Table01 tr td {
font-size: 16px;
color: #ccc;
}
.log-entry {
color: #00ff9d;
}
</style>
<script>
function AddTableFunvction(){
let xhr = new XMLHttpRequest();
let value = document.getElementById("03").value;
console.log("VALORE INVIATO:", value);
xhr.onreadystatechange = function() {
if(xhr.readyState == 4 && xhr.status == 200){
let T = document.getElementById("Table01");
T.innerHTML += "<tr><td class='log-entry'>" + xhr.responseText + "</td></tr>";
}
};
xhr.open("GET", "Gestionelog.php?AddInTable=true&NumberLog=" + encodeURIComponent(value), true);
xhr.send();
}
function RemoveTableFunction(){
let xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if(xhr.readyState == 4 && xhr.status == 200){
let T = document.getElementById("Table01");
T.innerHTML += "<tr><td class='log-entry'>" + xhr.responseText + "</td></tr>";
}
}
xhr.open("GET", "Gestionelog.php?RemoveDataInTable=true", true);
xhr.send();
}
function SeeAllLog(){
let xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if(xhr.readyState == 4 && xhr.status == 200){
console.log("Risposta:", xhr.responseText);
}
}
xhr.open("GET", "ReadDB.php", true);
xhr.send();
}
</script>
</head>
<body>
<table id="Table01">
<tr>
<td><button type="button" onclick="AddTableFunvction()">Add Log In the Table</button></td>
</tr>
<tr>
<td><button type="button" onclick="RemoveTableFunction()">Remove all Log In the Table</button></td>
</tr>
<tr>
<td>
<input type="number" id="03" min="0" value="100">
<span>Number of logs to read</span>
</td>
</tr>
<tr>
<td><button type="button" onclick="SeeAllLog()">See all log</button></td>
</tr>
</table>
</body>
</html>