-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
52 lines (47 loc) · 1.58 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
<!DOCTYPE html>
<html>
<head>
<title>
Inkulu Sampreeth's Homepage
</title>
</head>
<style>
body {
text-align: center;
}
</style>
<body>
<h1>
Hi! This is Sampreeth.
</h1>
<h3>
Thank you for coming over here.
</h3>
<div class="funny"></div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
function getRandomColor() {
var color = "#";
var letters = "0123456789ABCDEF";
for (var i = 0; i < 3; i++) {
color += letters[Math.floor(Math.random()*8)];
color += letters[Math.floor(Math.random()*16)];
}
return color;
}
function displayJoke() {
$.get("https://api.icndb.com/jokes/random/", function(data) {
if (data.type === "success") {
$(".funny").append(
"<h4>Here is something funny:-) for you:</h4>" +
"<div class = 'joke'>" + data.value.joke + "</div><br>" +
"<div>Source: <a href='http://www.icndb.com/' target = '_blank'>The Internet Chuck Norris Database</a></div>"
);
$(".joke").css("color", getRandomColor());
}
});
}
displayJoke();
</script>
</body>
</html>