-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
56 lines (50 loc) · 1.47 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<title>Custom Web Page</title>
<style>
body {
background-image: none;
transition: background-image 0.5s ease;
}
</style>
<script>
function displayHeader() {
fetch('/vm.txt')
.then(response => response.text())
.then(data => {
document.getElementById('header').textContent = data;
})
.catch(error => {
console.error('Error fetching the header content:', error);
});
}
function sendGetRequest() {
var xhr = new XMLHttpRequest();
xhr.open("GET", "http://10.0.0.53:8080/users", true);
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
var response = JSON.parse(xhr.responseText);
var responseString = JSON.stringify(response);
document.getElementById("response").textContent = responseString;
document.body.style.backgroundImage = "url('doge.jpg')";
}
};
xhr.send();
}
function refreshPage() {
location.reload();
}
function openImageLink() {
window.open("http://shinyub.site/dog", "_blank");
}
</script>
</head>
<body onload="displayHeader()">
<h1 id="header">Header Content</h1>
<button onclick="sendGetRequest()">Send GET Request</button>
<button onclick="refreshPage()">Refresh Page</button>
<button onclick="openImageLink()">Open Image Link</button>
<div id="response"></div>
</body>
</html>