-
Notifications
You must be signed in to change notification settings - Fork 0
/
Perros.html
154 lines (125 loc) · 4.41 KB
/
Perros.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Glass Website</title>
<link rel= "icon" href= "images/favicon.ico">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">
<link rel="preconnect" href="https://fonts.gstatic.com" />
<link
href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;700&display=swap"
rel="stylesheet"
/>
<link rel="stylesheet" href="./style.css" />
</head>
<body>
<main>
<!-- Ribbon grande de la izquierda -->
<section class="glass">
<div class="dashboard">
<div class="user">
<img src="./images/user.png" alt="" />
<h3>Usuario</h3>
<p>Usuario Premium</p>
</div>
<div class="container">
<div class="list-group">
<div class="row ">
<div class="col">
<h6>
<img src="./images/icons8_dog_35px_1.png" alt="" />
Perros
</h6>
</div>
</div>
<div class="row">
<div class="d-grid gap-2 col-6 mx-auto">
<a href="Gatos.html" type="button" class="btn">
<img src="./images/icons8_cat_35px_1.png" alt="" />
Gatos
</a>
</div>
</div>
<div class="row">
<div class="d-grid gap-2 col-6 mx-auto">
<a href="Peces.html" type="button" class="btn">
<img src="./images/icons8_whole_fish_35px.png" alt="" />
Peces
</a>
</div>
</div>
</div>
</div>
<!-- Boton perro grande abajo izquierda -->
<a href="index.html" class="btn mas">
<h3>¡Descubre qué perro eres!</h3>
<img src="./images/icons8_dog_park_127px.png" alt="" />
</a>
</div>
<!-- Ribbon derecha (API) -->
<div class="perros">
<div class="status">
<h1>Let there be dogs!</h1>
</div>
<div class="container">
<div class="col">
<div id="DogImage" class="result"></div>
</div>
<!-- Aquí poner la api y las imagenes que trae-->
<!-- <img id="DogImage" src="./images/labrador.jpg" class="img-resposive" alt=""> -->
<!-- <img id="DogImage"/> -->
</div>
<div class="col">
<!-- Aquí va el boton que hace el request -->
<div class="d-grid gap-2 col-6 mx-auto">
<br><button id="dog_btn" class="btn btn-primary btn-dark" type="button">Refresh</button>
</div>
</div>
</div>
</div>
</section>
</main>
<div class="circulo1"></div>
<div class="circulo2"></div>
</body>
<script>
const DogImage = document.getElementById('DogImage');
const dog_btn = document.getElementById('dog_btn');
dog_btn.addEventListener('click', findogs)
function findogs(){
fetch('https://random.dog/woof.json')
.then(res => res.json())
.then(data =>{
DogImage.innerHTML = `<img src="${data.url}"/>`
})
}
//var url="https://dog.ceo/api/breeds/image/random";
//debugger;
// function findogs()
// {
// //debugger;
// var data = undefined;
// var request = new XMLHttpRequest();
// request.open('GET', url, true);
// request.send();
// request.onreadystatechange = function(){
// if(this.readyState == 4 && this.status==200){
// var resultRawData = this.response;
// data = JSON.parse(resultRawData);
// //debugger;
// showDog(data);
// }
// }
// }
// function showDog(data)
// {
// //debugger;
// var dataURL= data.message;
// var element = document.getElementById("DogImage");
// var countingHtml = document.createElement('img');
// countingHtml.setAttribute("src", dataURL);
// element.appendChild(countingHtml);
// }
</script>
</html>