HTML:
<div class="box"> <button id="numberBtn">Generate Number</button> <div id="numberDisplay"></div> </div> <button id="resetBtn">Reset</button>
CSS:
<style> .box { border: 1px solid #000; padding: 20px; text-align: center; margin-bottom: 20px; } #numberDisplay { font-size: 24px; margin-top: 10px; } #resetBtn { display: block; margin: 0 auto; padding: 10px 20px; font-size: 16px; } </style>
JAVASCRIPT:
<script> document.getElementById('numberBtn').addEventListener('click', function() { var randomNumber = Math.floor(Math.random() * 10) + 1; document.getElementById('numberDisplay').innerText = randomNumber; }); document.getElementById('resetBtn').addEventListener('click', function() { document.getElementById('numberDisplay').innerText = ''; }); </script>
Try to answer about this code:
What does JavaScript primarily allow you to do in web development?
Create structured documents
Manipulate and interact with webpage elements
Define the layout of a webpage
Style the appearance of a webpage
Which tag is used for creating an unordered list in HTML?
<ol>
<ul>
<list>
<li>
Which of the following is used to style the appearance of a webpage?
HTML
CSS
XML
JavaScript
What does HTML stand for?
Hyperlink Text Markup Language
Hypertext Markup Language
Hyper Transfer Markup Language
High Text Markup Language