html
html
1
2
3
4
5
6
7
8
9
10
11
12
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<button id="myButton">roll</button><br>
<label id="myLabel1" class="myLabels"></label><br>
<label id="myLabel2" class="myLabels"></label><br>
<label id="myLabel3" class="myLabels"></label><br>
</body>
</html>
Enter to Rename, Shift+Enter to Preview
css
css
1
2
3
4
5
6
7
8
9
10
11
12
body {
font-family: verdana;
text-align: center;
}
#myButton{
font-size: 3em;
padding: 5px 25px;
border-radius: 5px;
}
.myLabels{
font-size: 3em;
}
Enter to Rename, Shift+Enter to Preview
js
js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
window.onload = function() {
const myButton = document.getElementById("myButton");
const myLabel1 = document.getElementById("myLabel1");
const myLabel2 = document.getElementById("myLabel2");
const myLabel3 = document.getElementById("myLabel3");
const min = 1;
const max = 6;
let randomNum1;
let randomNum2;
let randomNum3;
myButton.onclick = function() {
randomNum1 = Math.floor(Math.random() * max) + min;
randomNum2 = Math.floor(Math.random() * max) + min;
randomNum3 = Math.floor(Math.random() * max) + min;
myLabel1.textContent = randomNum1;
myLabel2.textContent = randomNum2;
myLabel3.textContent = randomNum3;
}
}
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Run