Commit 43649a6b by Yovan Martinez

finalizado los dados en javascript y html

parents
body {
font-family: cursive;
background: beige;
color: #333;
text-align: center;
top: 0px;
}
#boton {
vertical-align: middle;
}
#imagen {
vertical-align: initial;
width: 10%;
}
#imagen2 {
vertical-align: initial;
width: 10%;
}
#imagen3 {
vertical-align: initial;
width: 10%;
}
#imagen4 {
vertical-align: initial;
width: 10%;
}
#imagen5 {
vertical-align: initial;
width: 10%;
}
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>document</title>
<script src="dados.js"></script>
<link rel="stylesheet" href="css/estilos.css">
</head>
<body>
<button onclick="dados()">girar el dado</button>
<img src="" id="imagen">
<img src="" id="imagen2">
<img src="" id="imagen3">
<img src="" id="imagen4">
<img src="" id="imagen5">
<!-- <script src="dados.js"></script> -->
<p id="texto">
</p>
</body>
</html>
\ No newline at end of file
// window.onload = dados;
function dados() {
let misdados = ["imagenes/dado1.png", "imagenes/dado2.png", "imagenes/dado3.png", "imagenes/dado4.png", "imagenes/dado5.png", "imagenes/dado6.png"];
let indicedados = ["imagen", "imagen2", "imagen3", "imagen4", "imagen5"];
for (let index = 0; index < indicedados.length; index++) {
let indice = Math.floor(Math.random() * misdados.length);
document.getElementById(indicedados[index]).src = misdados[indice];
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment