Calculator Tools Calculator Tools
Create

Letter Slot Machine

Nov 12, 2023

About this app

A fun slot machine web app with various outcomes based on letters and timeframes.

Letter Slot Machine 🎰 Letter 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>Letter Slot Machine</title>
<meta name="description" content="A fun slot machine web app with various outcomes based on letters and timeframes.">
<meta name="keywords" content="slot machine, letters, years, months, weeks, game">

<link href="https://fonts.googleapis.com/css2?family=Lobster&display=swap" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" rel="stylesheet">

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

function randomize(arr) {
return arr[Math.floor(Math.random() * arr.length)];
}

function spin(letter) {
document.getElementById('result').innerText = 'Letter: ' + letter + ', Year: ' + randomize(years) + ', Month: ' + randomize(months) + ', Week: ' + randomize(weeks);
}

document.addEventListener("DOMContentLoaded", function() {
const buttons = ['A', 'B', 'C', 'D', 'E', 'F', 'G'];
buttons.forEach(button => {
const btn = document.createElement('button');
btn.innerText = button;
btn.onclick = function() { spin(button); };
document.getElementById('buttons').appendChild(btn);
});
});
} catch (error) {
// This will throw the error to the parent window.
throw error;
}
</script>

<style>
body {
background: linear-gradient(to right, #12c2e9, #c471ed, #f64f59);
font-family: 'Lobster', cursive;
color: #FFFFFF;
}

.container {
text-align: center;
padding-top: 3em;
}

button {
background-color: #4CAF50;
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}

#result {
margin-top: 2em;
font-size: 1.5em;
}
</style>
</head>
<body>
<div id="main-container" class="container">
<h1>🎰 Letter Slot Machine 💰</h1>
<div id="buttons"></div>
<div id="result"></div>
</div>
</body>
</html>