0% found this document useful (0 votes)
2 views

Number display.html

The document is an HTML page that allows users to input a number and start a sequence that displays random numbers up to the input value at specified intervals. It includes a simple user interface with an input field, a button, and a display area for the generated numbers. The sequence stops when the count reaches the input value, displaying a completion message.

Uploaded by

xuuu0702
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Number display.html

The document is an HTML page that allows users to input a number and start a sequence that displays random numbers up to the input value at specified intervals. It includes a simple user interface with an input field, a button, and a display area for the generated numbers. The sequence stops when the count reaches the input value, displaying a completion message.

Uploaded by

xuuu0702
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

<!

DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Dynamic Number Display</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
padding: 20px;
}
#display {
margin-top: 20px;
font-size: 24px;
color: #333;
}
</style>
</head>
<body>
<h1>Number Display</h1>
<input type="number" id="xValue" placeholder="Enter X value">
<button onclick="startSequence()">Start</button>
<div id="display"></div>

<script>
function startSequence() {
const x = parseInt(document.getElementById('xValue').value);
let count = 0;
const interval = setInterval(() => {
if (count >= x) {
clearInterval(interval); // Stop the interval when count
reaches X
document.getElementById('display').innerText = 'Sequence
completed!';
} else {
document.getElementById('display').innerText =
Math.floor(Math.random() * x);
count++;
}
}, x * 1000); // Multiply by 1000 to convert seconds to milliseconds
}
</script>
</body>
</html>

You might also like