Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Source-Code/DiceRoller/img/1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Source-Code/DiceRoller/img/2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Source-Code/DiceRoller/img/3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Source-Code/DiceRoller/img/4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Source-Code/DiceRoller/img/5.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Source-Code/DiceRoller/img/6.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions Source-Code/DiceRoller/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>DICE ROLLER</title>
</head>
<body>
<div id="container">
<h1>DICE ROLLER</h1>
<label>No of dice:</label>
<input type="number" value="1" id="noofdice" min="1">
<button type="button" onclick="roll()">Roll</button>
<div id="diceresult"></div>
<div id="diceimages"></div>
</div>
<script src="index.js"></script>
</body>
</html>
19 changes: 19 additions & 0 deletions Source-Code/DiceRoller/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
function roll(){

const noofdice=document.getElementById("noofdice").value;
const diceresult=document.getElementById("diceresult");
const diceimages=document.getElementById("diceimages");
const values=[];
const images=[];

for(let i=0;i<noofdice;i++){
const value=Math.floor(Math.random()*6)+1;
values.push(value);images.push(`<div style="display:inline-block; text-align:center; margin:5px;">
<img src="img/${value}.jpg" style="width:80px; height:80px;">
<div style="font-size:20px; font-weight:normal;">dice no ${i+1}</div>
</div>`);

}
diceresult.textContent=`dice values :${values.join(", ")}`;
diceimages.innerHTML=images.join(' ');
}
28 changes: 28 additions & 0 deletions Source-Code/DiceRoller/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#container{
font-family: Arial,sans-serif;
text-align: center;
font-size:2rem;
font-weight: bold;
}
button{
font-size: 1.5rem;
padding: 10px 15px;
border-radius: 15px;
border:none;
background-color: rgb(245, 138, 255);
cursor:pointer;
font-weight: bold;
color:white;
}
button:hover{
background-color: rgb(244, 92, 255);
}
button:active{
background-color: rgb(225, 185, 228);
}
input{
font-size: 2rem;
width: 150px;
font-weight: bold;
text-align: center;
}