Spaces:
Sleeping
Sleeping
Commit
·
43e5360
1
Parent(s):
596475f
Write templates/index.html
Browse filesCreating HTML template with buttons
- templates/index.html +71 -0
templates/index.html
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html>
|
3 |
+
<head>
|
4 |
+
<title>Button Demo</title>
|
5 |
+
<style>
|
6 |
+
body {
|
7 |
+
font-family: Arial, sans-serif;
|
8 |
+
max-width: 800px;
|
9 |
+
margin: 0 auto;
|
10 |
+
padding: 20px;
|
11 |
+
text-align: center;
|
12 |
+
}
|
13 |
+
.button {
|
14 |
+
display: inline-block;
|
15 |
+
padding: 10px 20px;
|
16 |
+
margin: 10px;
|
17 |
+
font-size: 16px;
|
18 |
+
cursor: pointer;
|
19 |
+
text-align: center;
|
20 |
+
text-decoration: none;
|
21 |
+
outline: none;
|
22 |
+
color: #fff;
|
23 |
+
background-color: #4CAF50;
|
24 |
+
border: none;
|
25 |
+
border-radius: 5px;
|
26 |
+
box-shadow: 0 5px #999;
|
27 |
+
}
|
28 |
+
.button:hover {background-color: #3e8e41}
|
29 |
+
.button:active {
|
30 |
+
background-color: #3e8e41;
|
31 |
+
box-shadow: 0 2px #666;
|
32 |
+
transform: translateY(4px);
|
33 |
+
}
|
34 |
+
.blue {background-color: #008CBA;}
|
35 |
+
.blue:hover {background-color: #0073aa;}
|
36 |
+
.blue:active {background-color: #0073aa;}
|
37 |
+
#result {
|
38 |
+
margin-top: 20px;
|
39 |
+
padding: 10px;
|
40 |
+
border: 1px solid #ddd;
|
41 |
+
border-radius: 5px;
|
42 |
+
min-height: 100px;
|
43 |
+
}
|
44 |
+
</style>
|
45 |
+
</head>
|
46 |
+
<body>
|
47 |
+
<h1>Button Demo</h1>
|
48 |
+
|
49 |
+
<button class="button" onclick="handleAction('action1')">Button 1</button>
|
50 |
+
<button class="button blue" onclick="handleAction('action2')">Button 2</button>
|
51 |
+
|
52 |
+
<div id="result">
|
53 |
+
<p>Result will appear here...</p>
|
54 |
+
</div>
|
55 |
+
|
56 |
+
<script>
|
57 |
+
function handleAction(action) {
|
58 |
+
fetch('/' + action, {
|
59 |
+
method: 'POST'
|
60 |
+
})
|
61 |
+
.then(response => response.json())
|
62 |
+
.then(data => {
|
63 |
+
document.getElementById('result').innerHTML = `<p>${data.result}</p>`;
|
64 |
+
})
|
65 |
+
.catch(error => {
|
66 |
+
document.getElementById('result').innerHTML = `<p>Error: ${error}</p>`;
|
67 |
+
});
|
68 |
+
}
|
69 |
+
</script>
|
70 |
+
</body>
|
71 |
+
</html>
|