16. Dynamic Download Counter with JavaScript and HTML.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Download Counter</title>
<script>
// Initialize the counter variable
var a = 1;
function down(event) {
// Prevent the form from submitting and refreshing the page
event.preventDefault();
// Update the paragraph with the current counter value
document.getElementById("sh").innerHTML = "Download count: " + a;
a++;
}
</script>
</head>
<body>
<h3>Download Counter Program</h3>
<!-- Changed input type to "button" -->
<form>
<input type="button" value="Download" onclick="down(event)">
</form>
<!-- Paragraph to display the download count -->
<p id="sh" aria-live="polite"></p>
</body>
</html>
Output
No Output Available