
Site için tıklayın
birçok versiyona uyarlanabilir, hayır butonuna bastığınızda buton sizden kaçıyor. Evet'e basabilirsiniz yalnızca

Kod:
<!DOCTYPE html>
<html lang="tr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
padding: 20px;
}
#question, #thankYouMessage {
font-size: 24px;
margin-bottom: 20px;
}
#yesButton, #noButton {
font-size: 20px;
padding: 10px 20px;
margin: 10px;
cursor: pointer;
}
#noButton {
position: absolute;
}
</style>
<script>
function showThankYou() {
document.getElementById("question").style.display = "none";
document.getElementById("yesButton").style.display = "none";
document.getElementById("thankYouMessage").style.d isplay = "block";
moveNoButton();
}
function moveNoButton() {
const maxWidth = window.innerWidth - 150; // 150px is the button width
const maxHeight = window.innerHeight - 50; // 50px is the button height
const randomX = Math.floor(Math.random() * maxWidth);
const randomY = Math.floor(Math.random() * maxHeight);
document.getElementById("noButton").style.left = randomX + "px";
document.getElementById("noButton").style.top = randomY + "px";
}
</script>
</head>
<body>
<div id="question">Devletten memnun musunuz?</div>
<button id="yesButton" onclick="showThankYou()">Evet</button>
<button id="noButton" onclick="moveNoButton()">Hayır</button>
<div id="thankYouMessage" style="display:none;">Teşekkür ederiz</div>
</body>
</html>
<html lang="tr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
padding: 20px;
}
#question, #thankYouMessage {
font-size: 24px;
margin-bottom: 20px;
}
#yesButton, #noButton {
font-size: 20px;
padding: 10px 20px;
margin: 10px;
cursor: pointer;
}
#noButton {
position: absolute;
}
</style>
<script>
function showThankYou() {
document.getElementById("question").style.display = "none";
document.getElementById("yesButton").style.display = "none";
document.getElementById("thankYouMessage").style.d isplay = "block";
moveNoButton();
}
function moveNoButton() {
const maxWidth = window.innerWidth - 150; // 150px is the button width
const maxHeight = window.innerHeight - 50; // 50px is the button height
const randomX = Math.floor(Math.random() * maxWidth);
const randomY = Math.floor(Math.random() * maxHeight);
document.getElementById("noButton").style.left = randomX + "px";
document.getElementById("noButton").style.top = randomY + "px";
}
</script>
</head>
<body>
<div id="question">Devletten memnun musunuz?</div>
<button id="yesButton" onclick="showThankYou()">Evet</button>
<button id="noButton" onclick="moveNoButton()">Hayır</button>
<div id="thankYouMessage" style="display:none;">Teşekkür ederiz</div>
</body>
</html>
