Browse Source

Würfelwurf zur Seite hinzugefügt

main
Richard Halsall 2 years ago
parent
commit
a219049a00
  1. 12
      schlangen_und_leitern/board.html
  2. 12
      schlangen_und_leitern/js/rollResult.js

12
schlangen_und_leitern/board.html

@ -5,12 +5,20 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="text/javascript" src="js/rollDice.js"></script> </script>
<script type="text/javascript" src="js/rollDice.js"></script>
<script type= "text/javascript" src="js/rollResult.js"></script>
<title>Document</title>
</head>
<body>
<input type = "button" id="rollButton" onclick = "rollDice()" value = "Würfeln">
<div class = "container">
<img src="/img/wurfle/f(1).png" id="face">
<input type = "button" id="rollButton" onclick = "changeFace()" value = "Würfeln">
</div>
</body>
</html>

12
schlangen_und_leitern/js/rollResult.js

@ -0,0 +1,12 @@
//Array mit Wurfle Bilder
let faces = ["img/wurfle/f(1).png",
"/img/wurfle/f(2).png",
"/img/wurfle/f(3).png",
"/img/wurfle/f(4).png",
"/img/wurfle/f(5).png",
"/img/wurfle/f(6).png",
];
//Wurfel Element durch "rollDice" function andern
function changeFace() {
document.querySelector("#face").src= faces[rollDice()-1];
}
Loading…
Cancel
Save