Calculator Tools Calculator Tools
Create

Alphabetical Slot Machine

Nov 12, 2023

About this app

A fun slot machine game with an alphabetical twist.

Alphabetical Slot Machine

Related apps

Put this on your site

Source

                    <html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Alphabetical Slot Machine</title>
<meta name="description" content="A fun slot machine game with an alphabetical twist.">
<meta name="keywords" content="slot machine, game, alphabetical, fun, interactive">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">

<script type="text/javascript">
try {
const slots = [
['2014', '2015', '2016'],
['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December', 'Special'],
['1', '2', '3', '4']
];

function spin() {
let results = '';
for (let i = 0; i < slots.length; i++) {
const randomIndex = Math.floor(Math.random() * slots[i].length);
results += slots[i][randomIndex] + ' ';
}
document.getElementById('result').innerHTML = results;
}

document.addEventListener("DOMContentLoaded", function() {
const buttons = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
for (let i = 0; i < buttons.length; i++) {
const button = document.createElement('button');
button.innerHTML = buttons[i];
button.addEventListener('click', spin);
document.getElementById('buttons').appendChild(button);
}
});

} catch (error) {
throw error;
}
</script>

<style>
button {
margin: 5px;
background-color: #4CAF50;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
transition-duration: 0.4s;
cursor: pointer;
}

button:hover {
background-color: #45a049;
}

#result {
font-size: 24px;
font-weight: bold;
margin-top: 20px;
}
</style>
</head>
<body>
<div id="main-container" class="container">
<div id="buttons"></div>
<div id="result"></div>
</div>
</body>
</html>