Embedding JavaScript
JavaScript can be embedded in an HTML page in different ways to add interactivity, manipulate the DOM, and handle events.
1. Inline JavaScript
You can place JavaScript directly inside an HTML tag using the onclick, onmouseover, or other event attributes.
🔹 Best for simple event handling but not recommended for larger applications.
2. Internal JavaScript
You can write JavaScript within a script tag inside an HTML file, usually placed in the <head> or at the bottom of <body>.
Qus. 1 : Which of the following is not considered as an error in JavaScript?
- Syntax error
- Accessing a variable or function that is not defined
- Division by zero
- None of these
- System.out.println("Hello Word")
- println ("Hello Word")
- document.write("Hello Word")
- response.write("Hello Word")
- <javascript>
- <script>
- <scripting>
- <link>
- <script name="data.js">
- <script href="data.js">
- <script src="data.js">
- <link href="data.js">
- <script href="xxx.js">
- <script src="xxx.js">
- <script name="xxx.js">
- <script id="xxx.js">
- <script src=" test.js"'></script>
- <script href=" test.js"></script>
- <import src=" test.js"></import>
- <script link=" test.js"></script>
- React
- Angular
- Vue.js
- Django