Which tag is used to enclose any number of javascript statements in HTML document?
<script>
The question asks about the specific HTML tag used to embed or include JavaScript code within an HTML document. Different HTML tags serve different purposes in structuring and presenting web content.
Let's examine each option provided to determine which one is correct for enclosing JavaScript statements:
Based on the analysis of the options, the tag specifically designed for embedding or referencing JavaScript code in an HTML document is the <script> tag.
Here is a simple example of how the <script> tag is used:
<!DOCTYPE html>
<html>
<head>
<title>JavaScript Example</title>
</head>
<body>
<h1>My Web Page</h1>
<script>
// This is a JavaScript statement
alert("Hello, World!");
</script>
</body>
</html>
In this example, the JavaScript statement alert("Hello, World!"); is enclosed within the <script> tags, allowing the browser to execute it.
Therefore, the tag used to enclose any number of JavaScript statements in an HTML document is the <script> tag.
| HTML Tag | Purpose | Used for JavaScript? |
|---|---|---|
| <code> | Represents a fragment of computer code. | No (for display only) |
| <script> | Embeds or links executable scripts (like JavaScript). | Yes |
| <title> | Defines the document's title. | No |
| <body> | Contains the visible page content. | No (while scripts can be *placed* here, the <script> tag is still needed) |
The <script> tag is fundamental for adding dynamic behavior to web pages using JavaScript. Key points about using the <script> tag include:
In HTML, month attribute defines a control with ______
Which of the following tag creates a checkbox for a form in HTML?
In a HTML form, which of the following input control is used for allowing users to make multiple selections?
What is the full form of SGML?
Which of the following is NOT a pair tag in HTML?