Over 10 years we helping companies reach their financial and branding goals. Onum is a values-driven SEO agency dedicated.

CONTACTS
ECET 2026 CSE

Day 46 – Evening Session: Web – DOM + JavaScript Events – ECET 2026

In ECET 2026 Web Technologies, DOM (Document Object Model) and JavaScript Events are guaranteed topics. Questions are mostly conceptual with small code snippets.


📘 Concept Notes

🌐 What is DOM?

  • DOM (Document Object Model): A programming interface for HTML/XML documents.
  • It represents the document as a tree structure (nodes and objects).
  • Every HTML element is a node in the DOM.

Example DOM Tree:

<html>
  <body>
    <h1>Hello</h1>
    <p>Welcome</p>
  </body>
</html>
  • <html> → Root Node
  • <body> → Child Node
  • <h1>, <p> → Leaf Nodes

⚙️ DOM Methods in JavaScript

Some important DOM methods:

  • document.getElementById("id") → Access element by ID
  • document.getElementsByClassName("class") → Access elements by class
  • document.querySelector("selector") → Access first matching element
  • element.innerHTML → Get/Set HTML content
  • element.style.property → Change CSS style

🎛 JavaScript Events

Events: Actions that occur in the browser (user interaction or system-generated).

Common Events:

  • onclick → when user clicks an element
  • onmouseover → when mouse hovers
  • onkeydown → when key is pressed
  • onchange → when input changes
  • onload → when page is loaded

Example – Button Click Event:

<button onclick="greet()">Click Me</button>

<script>
function greet() {
  alert("Hello, ECET Aspirant!");
}
</script>

📐 Example – DOM + Event Combined

<input type="text" id="uname" placeholder="Enter name">
<button onclick="showName()">Submit</button>
<p id="output"></p>

<script>
function showName() {
  let name = document.getElementById("uname").value;
  document.getElementById("output").innerHTML = "Welcome " + name;
}
</script>

👉 When user types name and clicks Submit, the text updates dynamically.


🔋 Formula Representation (Generalized)

For DOM traversals, tree nodes conceptually follow:

 \text{Document} \rightarrow \text{Element Nodes} \rightarrow \text{Attributes, Text Nodes}


🔟 10 Expected MCQs – ECET 2026

Q1. DOM stands for:
A) Document Object Model
B) Data Object Method
C) Document Oriented Module
D) Digital Object Model

Q2. In DOM, HTML is represented as:
A) List
B) Array
C) Tree
D) Table

Q3. Which DOM method selects element by ID?
A) getElementByName()
B) getElementById()
C) querySelectorAll()
D) getById()

Q4. Which property is used to change element content?
A) innerHTML
B) text
C) value
D) write()

Q5. Which event triggers when a button is clicked?
A) onhover
B) onclick
C) onchange
D) onpress

Q6. The root of DOM tree is:
A) body
B) html
C) head
D) document

Q7. Which event is fired when page is loaded?
A) onopen
B) onload
C) onenter
D) onstart

Q8. Which DOM method selects first matching CSS selector?
A) querySelector()
B) getElementsByClassName()
C) getElementByTagName()
D) getElement()

Q9. In DOM, attributes are also considered as:
A) Elements
B) Nodes
C) Properties
D) Classes

Q10. Which event fires when user presses a key?
A) onkeypress
B) onkeydown
C) onkeyup
D) All of the above


✅ Answer Key

Q.NoAnswer
Q1A
Q2C
Q3B
Q4A
Q5B
Q6B
Q7B
Q8A
Q9B
Q10D

🧠 Explanations

  • Q1 → A: DOM = Document Object Model.
  • Q2 → C: DOM structure = tree.
  • Q3 → B: getElementById("id") is correct.
  • Q4 → A: innerHTML modifies content.
  • Q5 → B: onclick event used for clicks.
  • Q6 → B: Root node is <html>.
  • Q7 → B: onload fires on page load.
  • Q8 → A: querySelector() selects first match.
  • Q9 → B: In DOM, attributes are nodes.
  • Q10 → D: Key events include keydown, keyup, keypress.

🎯 Why Practice Matters

  • DOM and Event-based questions are directly asked in Web Tech part.
  • Easy to secure 2–3 marks by remembering common methods and event names.
  • Practicing small code snippets gives confidence in both theory + lab exam.

📲 Join Our ECET Prep Community on WhatsApp

👉 Join WhatsApp Group – Click Here

Leave a comment

Your email address will not be published. Required fields are marked *