cremote/test-timeout.html

37 lines
1.1 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<title>Timeout Test</title>
<style>
.delayed-element {
display: none;
}
</style>
</head>
<body>
<h1>Timeout Test</h1>
<div id="immediate">This element is immediately available</div>
<div id="delayed" class="delayed-element">This element appears after 3 seconds</div>
<button id="slow-button">Slow Button (3s delay)</button>
<div id="result"></div>
<script>
// Show the delayed element after 3 seconds
setTimeout(() => {
document.getElementById('delayed').style.display = 'block';
}, 3000);
// Add a click handler to the slow button that takes 3 seconds to complete
document.getElementById('slow-button').addEventListener('click', function() {
const result = document.getElementById('result');
result.textContent = 'Processing...';
// Simulate a slow operation
setTimeout(() => {
result.textContent = 'Button click processed!';
}, 3000);
});
</script>
</body>
</html>