-
Notifications
You must be signed in to change notification settings - Fork 0
/
button.html
104 lines (71 loc) · 1.88 KB
/
button.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
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
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.button {
/*background-color: #4CAF50;*/
border: black;
color: white;
padding: 20px;
text-align: center;
text-decoration: none;
/*display: inline-block;*/
font-size: 16px;
/*margin: 4px 2px;*/
}
.button1 {border-radius: 2px;}
.button2 {border-radius: 4px;}
.button3 {border-radius: 8px;}
.button4 {border-radius: 12px;}
.button5 {border-radius: 50%;}
.btn {
border: 1px solid #000000;
background-color: inherit;
border-radius: 8px;
padding: 14px 28px;
font-size: 16px;
cursor: pointer;
/*display: inline-block;*/
}
.btn:hover {background: #eee;}
.success {color: green;}
.info {color: dodgerblue;}
.warning {color: orange;}
.danger {color: red;}
.default {color: black;}
</style>
</head>
<body>
<button onclick="myFunctionSuccess()" class="btn success">Success</button>
<button class="button4">Rounded</button>
<button class="btn warning">Warning</button>
<button class="btn danger">Danger</button>
<button class="btn default">Default</button>
<button onclick="myFunction()">Click me</button>
<p id="demo"></p>
<script>
function myFunction() {
document.getElementById("demo").innerHTML = "Hello World";
var xhr = new XMLHttpRequest();
xhr.open("GET", "bu.sh", true);
xhr.onload = function (e) {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
document.getElementById("demo").innerHTML = (xhr.responseText);
} else {
document.getElementById("demo").innerHTML = (xhr.statusText);
}
}
};
xhr.onerror = function (e) {
document.getElementById("demo").innerHTML = (xhr.statusText);
};
xhr.send(null);
}
function myFunctionSuccess() {
document.getElementById("demo").innerHTML = "Success!";
}
</script>
</body>
</html>