The document provides information about JavaScript and the Document Object Model (DOM). It discusses how JavaScript can dynamically access and update HTML elements using the DOM. It explains that all HTML elements are defined as objects in the DOM that can be accessed and manipulated using JavaScript properties and methods. The document provides examples of how to select elements, modify attributes and styles, add and remove elements, and handle events. It also covers common JavaScript objects like Date, Math, and built-in constructors.
The document discusses JavaScript, describing it as:
- Created in 1995 by Netscape and based on the ECMAScript standard.
- A dynamic, weakly typed, object-oriented programming language that is often misunderstood.
- Used for client-side scripting of webpages as well as server-side and application scripting.
- Commonly disliked due to past bad practices, implementations, and browser differences, but these issues are improving over time.
This document provides an overview of JavaScript, including:
- JavaScript is not related to Java and was originally called LiveScript.
- JavaScript code is run in web browsers by an interpreter built into the browser, not on servers.
- JavaScript can be used to add interactivity to HTML pages by including <script> tags and running code when pages load or in response to user events.
- JavaScript functions and variables can be defined and used to manipulate the DOM and handle user interactions.
Learning About JavaScript (…and its little buddy, JQuery!)Julie Meloni
Slides from an internal workshop at the GWU Library on 26 June 2012. The workshop was organized into three parts: "Understanding JavaScript Basics", "About the DOM (Document Object Model)", and "Where JQuery Fits in and How it Works".
Dom date and objects and event handlingsmitha273566
The document discusses the JavaScript Document Object Model (DOM) and regular expressions. It defines the DOM as a programming interface for HTML and XML documents that defines the logical structure and allows manipulation. It describes how the DOM represents an HTML document as a tree of nodes that can be accessed and modified with JavaScript. It provides examples of how to select elements, modify attributes and content, add and remove nodes, and handle events. Regular expressions are also mentioned as a topic.
This document discusses JavaScript objects and the Document Object Model (DOM) in JavaScript. It covers:
1. The three ways to create objects in JavaScript - using object literals, the Object constructor, and object constructors. Examples are provided.
2. The document object which represents the HTML document and allows dynamic content to be added to web pages. Properties and methods of the document object are mentioned.
3. An overview of selecting, traversing, manipulating DOM elements using JavaScript. Methods like getElementById(), getElementsByName(), and querySelector() for selection and appendChild(), textContent for manipulation are discussed.
Javascript allows interactive content on web pages and control of the browser and document. It is an interpreted scripting language that is cross-platform but support varies. Javascript can provide interactive content, control document appearance and content, and interact with the user through event handlers.
This document provides an overview of JavaScript, including:
- Its origins and development over time
- How it can be used to make webpages dynamic and interactive
- Key JavaScript concepts like variables, arrays, functions, and events
- How it interacts with and manipulates the DOM
- Its rebirth with the introduction of AJAX, which allows asynchronous data fetching and partial page updates
This document discusses Dynamic HTML (DHTML) and JavaScript. It defines DHTML as the combination of HTML, JavaScript, CSS, and the DOM to create animated and interactive web pages. It describes the DOM as a standard for accessing and manipulating HTML and XML documents as tree structures. The chapter then explains JavaScript and how it can be used with the DOM to dynamically access and update HTML content, structure, and style. It provides examples of common JavaScript methods and properties for manipulating the DOM, interacting with browsers, and displaying data.
Cordova training : Day 4 - Advanced JavascriptBinu Paul
This document provides an overview of JavaScript objects, properties, methods, and built-in objects. It discusses how objects are composed of attributes, which can include functions called methods. It describes how to add properties, create user-defined objects, and use built-in constructors. The document also summarizes built-in objects like Date, Math, String, and Array, and their common properties and methods. Finally, it discusses accessing the DOM, events, JSON, and parsing JSON into JavaScript objects.
This document provides an overview of JavaScript including:
1. Why JavaScript is important for web development as one of the three main languages used along with HTML and CSS.
2. The different ways JavaScript can display data such as writing to HTML elements or using alerts.
3. Key JavaScript concepts such as variables, comments, functions, objects, and errors.
4. How JavaScript interacts with the DOM to modify HTML elements and handle events.
This document provides an overview of JavaScript, including:
- JavaScript is a prototype-based, dynamic, loosely typed, multi-paradigm scripting language used primarily for client-side web applications.
- JavaScript can also be used for server-side applications with Node.js, databases like MongoDB, and other applications.
- The basics of JavaScript include variables, functions, objects, and operators. Functions have their own scope and arguments are passed by value for primitives and by reference for objects.
- The Document Object Model (DOM) represents HTML documents and allows JavaScript to programmatically access and modify elements and attributes.
- Popular JavaScript libraries like jQuery simplify DOM manipulation and other tasks, using CSS selectors
JavaScript is a client-side scripting language that adds interactivity to HTML pages. It can be embedded in HTML using <script> tags and scripts can be placed internally in the HTML file or externally in a .js file. JavaScript code can be inserted in the <head> or <body> sections, but is typically placed at the end of the <body> for faster page loads. Core JavaScript concepts include variables, objects, functions, operators, conditions, loops, and arrays. The DOM (Document Object Model) allows JavaScript to access and modify HTML elements on the page and events can be used to trigger JavaScript functions in response to user actions.
The document provides an overview of jQuery and JavaScript concepts. It discusses:
1. What jQuery is and why it's useful, allowing developers to simplify common tasks with fewer lines of code.
2. How to access DOM elements using jQuery selectors, which are similar to CSS selectors. This allows selecting elements by name, ID, class, and other attributes.
3. Core JavaScript concepts like variables, data types, operators, and functions. It also covers variable scope, error handling, and working with objects.
This document discusses JavaScript performance best practices. It covers loading and execution performance, DOM scripting performance, and patterns to minimize repaints and reflows. Some key points include batching DOM changes, event delegation to reduce event handlers, and taking elements out of the document flow during animations. References are provided to resources on JavaScript performance testing and design patterns.
This article is the first part of a series of articles on using JavaScript tools. Today, JavaScript is a very powerful language that can be used to build web apps, mobile apps, and even some pc games — perhaps a bit faster than you would build them otherwise.
New libraries have emerged in the web industry to address the challenges of JavaScript — libraries such as JQuery, Prototype and many others have been released. Today, a popular question asked by many is — should i learn the libraries such as jQuery or learn basic JavaScript. The truth is that the libraries help you to create faster, responsive JavaScript, but there are still times when your basic knowlege of JavaScript will be called into question. It is for this reason that I have created this eBook, to assist newbies learn JavaScript.
Put on by USC's Upsilon Pi Epsilon as part of Wonderful World of Web2.0 Workshop Series.
http://pollux.usc.edu/~upe/
JavaScript can dynamically manipulate the content, structure, and styling of an HTML document through the Document Object Model (DOM). The DOM represents an HTML document as nodes that can be accessed and modified with JavaScript. Common tasks include dynamically creating and adding elements, handling user events like clicks, and updating content by accessing DOM elements by their id or other attributes.
This document provides an overview of JavaScript, including:
- JavaScript is not related to Java and was originally called LiveScript.
- JavaScript code is run in web browsers by an interpreter built into the browser, not on servers.
- JavaScript can be used to add interactivity to HTML pages by including <script> tags and running code when pages load or in response to user events.
- JavaScript functions and variables can be defined and used to manipulate the DOM and handle user interactions.
Learning About JavaScript (…and its little buddy, JQuery!)Julie Meloni
Slides from an internal workshop at the GWU Library on 26 June 2012. The workshop was organized into three parts: "Understanding JavaScript Basics", "About the DOM (Document Object Model)", and "Where JQuery Fits in and How it Works".
Dom date and objects and event handlingsmitha273566
The document discusses the JavaScript Document Object Model (DOM) and regular expressions. It defines the DOM as a programming interface for HTML and XML documents that defines the logical structure and allows manipulation. It describes how the DOM represents an HTML document as a tree of nodes that can be accessed and modified with JavaScript. It provides examples of how to select elements, modify attributes and content, add and remove nodes, and handle events. Regular expressions are also mentioned as a topic.
This document discusses JavaScript objects and the Document Object Model (DOM) in JavaScript. It covers:
1. The three ways to create objects in JavaScript - using object literals, the Object constructor, and object constructors. Examples are provided.
2. The document object which represents the HTML document and allows dynamic content to be added to web pages. Properties and methods of the document object are mentioned.
3. An overview of selecting, traversing, manipulating DOM elements using JavaScript. Methods like getElementById(), getElementsByName(), and querySelector() for selection and appendChild(), textContent for manipulation are discussed.
Javascript allows interactive content on web pages and control of the browser and document. It is an interpreted scripting language that is cross-platform but support varies. Javascript can provide interactive content, control document appearance and content, and interact with the user through event handlers.
This document provides an overview of JavaScript, including:
- Its origins and development over time
- How it can be used to make webpages dynamic and interactive
- Key JavaScript concepts like variables, arrays, functions, and events
- How it interacts with and manipulates the DOM
- Its rebirth with the introduction of AJAX, which allows asynchronous data fetching and partial page updates
This document discusses Dynamic HTML (DHTML) and JavaScript. It defines DHTML as the combination of HTML, JavaScript, CSS, and the DOM to create animated and interactive web pages. It describes the DOM as a standard for accessing and manipulating HTML and XML documents as tree structures. The chapter then explains JavaScript and how it can be used with the DOM to dynamically access and update HTML content, structure, and style. It provides examples of common JavaScript methods and properties for manipulating the DOM, interacting with browsers, and displaying data.
Cordova training : Day 4 - Advanced JavascriptBinu Paul
This document provides an overview of JavaScript objects, properties, methods, and built-in objects. It discusses how objects are composed of attributes, which can include functions called methods. It describes how to add properties, create user-defined objects, and use built-in constructors. The document also summarizes built-in objects like Date, Math, String, and Array, and their common properties and methods. Finally, it discusses accessing the DOM, events, JSON, and parsing JSON into JavaScript objects.
This document provides an overview of JavaScript including:
1. Why JavaScript is important for web development as one of the three main languages used along with HTML and CSS.
2. The different ways JavaScript can display data such as writing to HTML elements or using alerts.
3. Key JavaScript concepts such as variables, comments, functions, objects, and errors.
4. How JavaScript interacts with the DOM to modify HTML elements and handle events.
This document provides an overview of JavaScript, including:
- JavaScript is a prototype-based, dynamic, loosely typed, multi-paradigm scripting language used primarily for client-side web applications.
- JavaScript can also be used for server-side applications with Node.js, databases like MongoDB, and other applications.
- The basics of JavaScript include variables, functions, objects, and operators. Functions have their own scope and arguments are passed by value for primitives and by reference for objects.
- The Document Object Model (DOM) represents HTML documents and allows JavaScript to programmatically access and modify elements and attributes.
- Popular JavaScript libraries like jQuery simplify DOM manipulation and other tasks, using CSS selectors
JavaScript is a client-side scripting language that adds interactivity to HTML pages. It can be embedded in HTML using <script> tags and scripts can be placed internally in the HTML file or externally in a .js file. JavaScript code can be inserted in the <head> or <body> sections, but is typically placed at the end of the <body> for faster page loads. Core JavaScript concepts include variables, objects, functions, operators, conditions, loops, and arrays. The DOM (Document Object Model) allows JavaScript to access and modify HTML elements on the page and events can be used to trigger JavaScript functions in response to user actions.
The document provides an overview of jQuery and JavaScript concepts. It discusses:
1. What jQuery is and why it's useful, allowing developers to simplify common tasks with fewer lines of code.
2. How to access DOM elements using jQuery selectors, which are similar to CSS selectors. This allows selecting elements by name, ID, class, and other attributes.
3. Core JavaScript concepts like variables, data types, operators, and functions. It also covers variable scope, error handling, and working with objects.
This document discusses JavaScript performance best practices. It covers loading and execution performance, DOM scripting performance, and patterns to minimize repaints and reflows. Some key points include batching DOM changes, event delegation to reduce event handlers, and taking elements out of the document flow during animations. References are provided to resources on JavaScript performance testing and design patterns.
This article is the first part of a series of articles on using JavaScript tools. Today, JavaScript is a very powerful language that can be used to build web apps, mobile apps, and even some pc games — perhaps a bit faster than you would build them otherwise.
New libraries have emerged in the web industry to address the challenges of JavaScript — libraries such as JQuery, Prototype and many others have been released. Today, a popular question asked by many is — should i learn the libraries such as jQuery or learn basic JavaScript. The truth is that the libraries help you to create faster, responsive JavaScript, but there are still times when your basic knowlege of JavaScript will be called into question. It is for this reason that I have created this eBook, to assist newbies learn JavaScript.
Put on by USC's Upsilon Pi Epsilon as part of Wonderful World of Web2.0 Workshop Series.
http://pollux.usc.edu/~upe/
JavaScript can dynamically manipulate the content, structure, and styling of an HTML document through the Document Object Model (DOM). The DOM represents an HTML document as nodes that can be accessed and modified with JavaScript. Common tasks include dynamically creating and adding elements, handling user events like clicks, and updating content by accessing DOM elements by their id or other attributes.
Function overloading allows a function to be defined multiple times with different parameters and is resolved at compile time, while function overriding requires inheritance and allows a function to be redefined in a subclass with the same parameters and is resolved at runtime.
What Operating Systems Do
Computer System Organization
Computer System Architecture
Operating System Structure
Operating System Operations
Distributed Systems
Open Source Operating Systems.
Operating System definitions and about system calls
Operating System Services
User and Operating System-Interface
System Calls
Types of system calls
System Programs
This document provides an overview of operating systems. It defines an operating system as a program that acts as an interface between the user and computer hardware to control execution of programs. The document then describes key functions of operating systems like memory management, processor management, device management, file management, and security. It also outlines different types of operating systems including batch, time-sharing, distributed, network, and real-time operating systems.
Adam Grant: Transforming Work Culture Through Organizational PsychologyPrachi Shah
This presentation explores the groundbreaking work of Adam Grant, renowned organizational psychologist and bestselling author. It highlights his key theories on giving, motivation, leadership, and workplace dynamics that have revolutionized how organizations think about productivity, collaboration, and employee well-being. Ideal for students, HR professionals, and leadership enthusiasts, this deck includes insights from his major works like Give and Take, Originals, and Think Again, along with interactive elements for enhanced engagement.
Jack Lutkus is an education champion, community-minded innovator, and cultural enthusiast. A social work graduate student at Aurora University, he also holds a BA from the University of Iowa.
*Order Hemiptera:*
Hemiptera, commonly known as true bugs, is a large and diverse order of insects that includes cicadas, aphids, leafhoppers, and shield bugs. Characterized by their piercing-sucking mouthparts, Hemiptera feed on plant sap, other insects, or small animals. Many species are significant pests, while others are beneficial predators.
*Order Neuroptera:*
Neuroptera, also known as net-winged insects, is an order of insects that includes lacewings, antlions, and owlflies. Characterized by their delicate, net-like wing venation and large, often prominent eyes, Neuroptera are predators that feed on other insects, playing an important role in biological control. Many species have aquatic larvae, adding to their ecological diversity.
Smart Borrowing: Everything You Need to Know About Short Term Loans in Indiafincrifcontent
Short term loans in India are becoming a go-to financial solution for individuals needing quick access to funds without long-term commitments. With fast approval, minimal documentation, and flexible tenures, these loans are ideal for handling emergencies, unexpected bills, or short-term goals. Understanding key aspects like short term loan features, eligibility, required documentation, and how to apply for a short term loan can help borrowers make informed decisions. Whether you're salaried or self-employed, short term loans offer convenience and speed. This guide walks you through the essentials so you can secure the right loan at the right time.
Forestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdfChalaKelbessa
This is Forestry Exit Exam Model for 2025 from Department of Forestry at Wollega University, Gimbi Campus.
The exam contains forestry courses such as Dendrology, Forest Seed and Nursery Establishment, Plantation Establishment and Management, Silviculture, Forest Mensuration, Forest Biometry, Agroforestry, Biodiversity Conservation, Forest Business, Forest Fore, Forest Protection, Forest Management, Wood Processing and others that are related to Forestry.
Analysis of Quantitative Data Parametric and non-parametric tests.pptxShrutidhara2
This presentation covers the following points--
Parametric Tests
• Testing the Significance of the Difference between Means
• Analysis of Variance (ANOVA) - One way and Two way
• Analysis of Co-variance (One-way)
Non-Parametric Tests:
• Chi-Square test
• Sign test
• Median test
• Sum of Rank test
• Mann-Whitney U-test
Moreover, it includes a comparison of parametric and non-parametric tests, a comparison of one-way ANOVA, two-way ANOVA, and one-way ANCOVA.
Christian education is an important element in forming moral values, ethical Behaviour and
promoting social unity, especially in diverse nations like in the Caribbean. This study examined
the impact of Christian education on the moral growth in the Caribbean, characterized by
significant Christian denomination, like the Orthodox, Catholic, Methodist, Lutheran and
Pentecostal. Acknowledging the historical and social intricacies in the Caribbean, this study
tends to understand the way in which Christian education mold ethical decision making, influence interpersonal relationships and promote communal values. These studies’ uses, qualitative and quantitative research method to conduct semi-structured interviews for twenty
(25) Church respondents which cut across different age groups and genders in the Caribbean. A
thematic analysis was utilized to identify recurring themes related to ethical Behaviour, communal values and moral development. The study analyses the three objectives of the study:
how Christian education Mold’s ethical Behaviour and enhance communal values, the role of
Christian educating in promoting ecumenism and the effect of Christian education on moral
development. Moreover, the findings show that Christian education serves as a fundamental role
for personal moral evaluation, instilling a well-structured moral value, promoting good
Behaviour and communal responsibility such as integrity, compassion, love and respect. However, the study also highlighted challenges including biases in Christian teachings, exclusivity and misconceptions about certain practices, which impede the actualization of
Artificial intelligence Presented by JM.jmansha170
AI (Artificial Intelligence) :
"AI is the ability of machines to mimic human intelligence, such as learning, decision-making, and problem-solving."
Important Points about AI:
1. Learning – AI can learn from data (Machine Learning).
2. Automation – It helps automate repetitive tasks.
3. Decision Making – AI can analyze and make decisions faster than humans.
4. Natural Language Processing (NLP) – AI can understand and generate human language.
5. Vision & Recognition – AI can recognize images, faces, and patterns.
6. Used In – Healthcare, finance, robotics, education, and more.
Owner By:
Name : Junaid Mansha
Work : Web Developer and Graphics Designer
Contact us : +92 322 2291672
Email : [email protected]
How to Configure Add to Cart in Odoo 18 WebsiteCeline George
In this slide, we’ll discuss how to configure the Add to Cart functionality in the Odoo 18 Website. This feature enhances the shopping experience by offering three flexible options: Stay on the Product Page, Go to the Cart, or Let the User Decide through a dialog box.
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptxArshad Shaikh
Diptera, commonly known as flies, is a large and diverse order of insects that includes mosquitoes, midges, gnats, and horseflies. Characterized by a single pair of wings (hindwings are modified into balancing organs called halteres), Diptera are found in almost every environment and play important roles in ecosystems as pollinators, decomposers, and food sources. Some species, however, are significant pests and disease vectors, transmitting diseases like malaria, dengue, and Zika virus.
IDSP is a disease surveillance program in India that aims to strengthen/maintain decentralized laboratory-based IT enabled disease surveillance systems for epidemic prone diseases to monitor disease trends, and to detect and respond to outbreaks in the early phases swiftly.....
Prottutponnomotittwa: A Quiz That Echoed the Pulse of Bengal
On the 31st of May, 2025, PRAGYA – The Official Quiz Club of UEM Kolkata – did not merely organize another quiz. It hosted an ode to Bengal — its people, its quirks, its politics, its art, its rebellion, its heritage. Titled Prottutponnomotittwa, the quiz stood as a metaphor for what Bengal truly is: sharp, intuitive, spontaneous, reflective. A cultural cosmos that thrives on instinct, memory, and emotion.
From the very first slide, it became clear — this wasn’t a quiz made to showcase difficulty or elitism. It was crafted with love — love for Bangla, for its past, present, and its ever-persistent contradictions.
The diversity of the answer list tells the real story of the quiz. The curation was not random. Each answer was a string on a veena of cultural resonance.
In the “Cultural Pairings” round, Anusheh Anadil and Arnob were placed not just as musicians, but as voices of a modern, cross-border Bangla. Their works, which blend baul, jazz, and urban folk, show how Bengal exists simultaneously in Dhaka and Shantiniketan.
The inclusion of Ritwik Chakraborty and Srijit Mukherjee (as a songwriter) showed how the quiz masters understood evolution. Bangla cinema isn’t frozen in the Ray-Ghatak past. It lives, argues, breaks molds — just like these men do.
From Kalyani Black Label to Radhunipagol Chal, consumer culture too had its place. One is liquid courage, the other culinary madness — both deeply Bengali.
The heart truly swelled when the answers touched upon Baidyanath Bhattacharya and Chandril. Both satirists, both sharp, both essential. It was not just about naming them — it was about understanding what different types of literature means in a Bengali context.
Titumir — the play about a peasant rebel who built his own bamboo fort and dared to challenge the British.
Krishnananda Agamvagisha — the mystical Tantric who shaped how we understand esoteric Bengali spiritualism.
Subhas Chandra Bose — the eternal enigma, the braveheart whose shadow looms large over Bengal’s political psyche.
Probashe Ghorkonna — a story lived by many Bengalis. The medinipur daughter, who made a wholesome family, not only in bengal, but across the borders. This answer wasn’t just information. It was emotion.
By the end, what lingered was not the scoreboard. It was a feeling.
The feeling of sitting in a room where Chalchitro meets Chabiwala, where Jamai Shosthi shares the stage with Gayatri Spivak, where Bhupen Hazarika sings with Hemanga Biswas, and where Alimuddin Road and Webskitters occupy the same mental map.
You don’t just remember questions from this quiz.
You remember how it made you feel.
You remember smiling at Keet Keet, nodding at Prabuddha Dasgupta, getting goosebumps at the mention of Bose, and tearing up quietly when someone got Radhunipagol Chal right.
This wasn’t a quiz.
This was an emotional ride of Bangaliyana.
This was — and will remain — Prottutponnomotittwa.
RE-LIVE THE EUPHORIA!!!!
The Quiz club of PSGCAS brings to you a fun-filled breezy general quiz set from numismatics to sports to pop culture.
Re-live the Euphoria!!!
QM: Eiraiezhil R K,
BA Economics (2022-25),
The Quiz club of PSGCAS
2. Add JavaScript to HTML pages
To add JavaScript to HTML pages, there are three
primary methods:
Embedding javascript directly within the HTML
Using inline javascript
Linking to an external javascript file.
3. 1. Embedding JavaScript
JavaScript can be embedded directly into an HTML document using
the <script> tag.
This tag can be placed in either the <head> or <body> sections of the HTML,
depending on when you want the script to execute.
OUTPUT
4. 2. Inline JavaScript
Inline JavaScript is used when you want to execute JavaScript
code directly within an HTML element's event attribute.
This method is often used for simple tasks.
5. 3. External JavaScript
For larger scripts or when you want to reuse JavaScript across multiple pages,
you can create an external JavaScript file.
This file should have a .js extension and can be linked to your HTML document
using the <script> tag with the src attribute.
6. What can we do with JavaScript?
• To create interactive user interface in a web page (e.g., menu,
pop-up alert, windows, etc.)
• Manipulating web content dynamically
• Change the content and style of an element
• Replace images on a page without page reload
• Hide/Show contents
• Generate HTML contents on the fly
• Form validation
• AJAX (e.g. Google complete)., etc.
7. Advantages of Using External JavaScript
Reusability: The same JavaScript file can be linked to multiple HTML
files, reducing redundancy.
Improved Readability: Keeping JavaScript separate from HTML makes
both easier to read and maintain.
Caching: Browsers cache external JavaScript files, which can lead to
faster page load times on subsequent visits.
Parallel Development: Web designers and developers can work
independently on HTML and JavaScript, respectively, without conflicts
10. alert(), confirm(), and prompt()
<script type="text/javascript">
alert("This is an Alert method");
confirm("Are you OK?");
prompt("What is your name?");
prompt("How old are you?","20");
</script>
11. JavaScript Functions
A JavaScript function is a block of code designed to perform a particular task. It
encapsulates a set of instructions that can be reused throughout a program.
Functions can take parameters, execute statements, and return values, enabling
code organization, modularity, and reusability in JavaScript programming.
Syntax: The basic syntax to create a function in JavaScript is shown below.
function functionName(Parameter1, Parameter2, ...)
{
// Function body
}
12. Example
function myFunction(g1, g2) {
return g1 / g2;
}
const value = myFunction(8, 2); // Calling the function
console.log(value);
Output
4
13. Rules for creating a function
Every function should begin with the keyword function followed by,
A user-defined function name that should be unique,
A list of parameters enclosed within parentheses and separated by commas,
A list of statements composing the body of the function enclosed within curly
braces {}.
14. Function Invocation
When an event occurs (when a user clicks a button)
When it is invoked (called) from JavaScript code
Automatically (self invoked)
15. Function Return
When JavaScript reaches a return statement, the function will stop executing.
If the function was invoked from a statement, JavaScript will "return" to execute the code after the invoking
statement.
Functions often compute a return value. The return value is "returned" back to the "caller":
17. Functions Used as Variable Values
Instead of using a variable to store the return value of a function:
let x = toCelsius(77);
let text = "The temperature is " + x + " Celsius";
You can use the function directly, as a variable value:
let text = "The temperature is " + toCelsius(77) + " Celsius";
19. JavaScript Function Object
The purpose of Function constructor is to create a new Function object. It executes the code globally.
if we call the constructor directly, a function is created dynamically but in an unsecured way.
Syntax : new Function ([arg1[, arg2[, ....argn]],] functionBody)
20. JavaScript Function Methods
Method Description
apply() It is used to call a function contains this value
and a single array of arguments.
bind() It is used to create a new function.
call() It is used to call a function contains this value
and an argument list.
toString() It returns the result in a form of a string.
21. JavaScript Objects
JavaScript is an object-based language. Everything is an object in
JavaScript.
JavaScript is template based not class based. Here, we don't create class
to get the object. But, we direct create objects.
There are 3 ways to create objects.
By object literal
By creating instance of Object directly (using new keyword)
By using an object constructor (using new keyword)
22. JavaScript Object by object literal
The syntax of creating object using object literal
object={property1:value1,property2:value2.....propertyN:valueN}
23. Creating instance of Object
The syntax of creating object directly
var objectname=new Object();
Here, new keyword is used to create object.
24. By using an Object constructor
Here, you need to create function with arguments.
Each argument value can be assigned in the current object by using this
keyword.
The this keyword refers to the current object.
25. The HTML DOM (Document Object Model)
"The Document Object Model (DOM) is a platform and language-neutral interface that allows
programs and scripts to dynamically access and update the content, structure, and style of a
document.“
The Document Object Model (DOM) is a programming interface for web documents. It
represents the page so that programs can change the document structure, style, and content.
The DOM represents the document as nodes and objects; that way, programming languages
can interact with the page.
A web page is a document that can be either displayed in the browser window or as the
HTML source. In both cases, it is the same document but the Document Object Model (DOM)
representation allows it to be manipulated. As an object-oriented representation of the web
page, it can be modified with a scripting language such as JavaScript.
27. Structure of the DOM
The DOM represents a document as a logical tree structure, where each
node is an object representing a part of the document. This includes
elements, attributes, text, and other components. The main components of
the DOM include:
Document Node: The root of the DOM tree, representing the entire
document.
Element Nodes: These represent HTML elements (e.g., <div>, <p>, <h1>).
Text Nodes: These contain the text within elements.
Attribute Nodes: These represent attributes of elements (e.g., class, id).
28. Importance of the DOM
The DOM is crucial for creating dynamic and interactive web applications. It allows
developers to:
Update the content of web pages without reloading them, enhancing user experience.
Respond to user events such as clicks, form submissions, and keyboard inputs.
Create single-page applications (SPAs) that load content dynamically.
The DOM is standardized by the World Wide Web Consortium (W3C) and is an essential
concept for web development, enabling the integration of HTML, CSS, and JavaScript to
create rich web experiences
basically Document Object Model is an API that represents and interacts with HTML or
XML documents.
29. Accessing and Manipulating the DOM
JavaScript can interact with the DOM to perform various operations:
Accessing Elements: You can access elements using methods like getElementById(),
getElementsByClassName(), and querySelector().
Modifying Content: The content of elements can be changed using properties like
innerHTML, textContent, and value.
Changing Styles: You can modify CSS styles directly through the style property of an
element.
Adding and Removing Elements: New elements can be created using createElement()
and added to the DOM with appendChild(), while existing elements can be removed
with removeChild().
30. Reasons for Document Object Model (DOM) in web development
Dynamic Web Pages: It allows you to create dynamic web pages. It enables the JavaScript to access
and manipulate page content, structure, and style dynamically which gives interactive and responsive
web experiences, such as updating content without reloading the entire page or responding to user
actions instantly.
Interactivity: With the DOM, you can respond to user actions (like clicks, inputs, or scrolls) and modify
the web page accordingly.
Content Updates: When you want to update the content without refreshing the entire page, the DOM
enables targeted changes making the web applications more efficient and user-friendly.
Cross-Browser Compatibility: Different browsers may render HTML and CSS in different ways. The
DOM provides a standardized way to interact with page elements.
Single-Page Applications (SPAs): Applications built with frameworks such as React or Angular,
heavily rely on the DOM for efficient rendering and updating of content within a single HTML page
without reloading the full page.
31. jQuery Introduction
jQuery is an open-source JavaScript library that simplifies the
interactions between an HTML/CSS document, or more precisely
the Document Object Model (DOM).
jQuery simplifies HTML document traversing and manipulation,
browser event handling, DOM animations, Ajax interactions, and
cross-browser JavaScript development.