66 lines
1.7 KiB
HTML
66 lines
1.7 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Click Counter</title>
|
|
<style>
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
max-width: 600px;
|
|
margin: 50px auto;
|
|
padding: 20px;
|
|
text-align: center;
|
|
background-color: #121212;
|
|
color: #f5f5f5;
|
|
}
|
|
h1 {
|
|
color: #f5f5f5;
|
|
}
|
|
button {
|
|
padding: 20px 40px;
|
|
font-size: 18px;
|
|
background-color: #2563eb;
|
|
color: #f5f5f5;
|
|
border: 1px solid #1d4ed8;
|
|
border-radius: 8px;
|
|
cursor: pointer;
|
|
margin: 30px 0;
|
|
transition: background-color 0.3s, transform 0.1s;
|
|
box-shadow: 0 10px 25px rgba(37, 99, 235, 0.25);
|
|
}
|
|
button:hover {
|
|
background-color: #1d4ed8;
|
|
}
|
|
button:active {
|
|
transform: scale(0.98);
|
|
}
|
|
#counter {
|
|
margin-top: 30px;
|
|
font-size: 24px;
|
|
font-weight: bold;
|
|
color: #86efac;
|
|
min-height: 50px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>Click Counter</h1>
|
|
|
|
<button id="button">Click Me!</button>
|
|
|
|
<div id="counter">Button clicked 0 times</div>
|
|
|
|
<script>
|
|
let clickCount = 0;
|
|
const clickBtn = document.getElementById('button');
|
|
const counter = document.getElementById('counter');
|
|
|
|
clickBtn.addEventListener('click', function() {
|
|
clickCount++;
|
|
counter.textContent = `Button clicked ${clickCount} times`;
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|