0% found this document useful (0 votes)
14 views6 pages

Adobe Scan 25 Jun 2023

The document is a tutorial on JavaScript that covers inserting scripts into HTML pages, creating and calling functions, manipulating the Document Object Model (DOM), and working with nodes in the DOM. It provides examples of how to dynamically change text on a webpage without reloading using event handlers, functions, and DOM manipulation with JavaScript. It also lists common comparison operators that can be used to compare data in JavaScript.

Uploaded by

naimnoman123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views6 pages

Adobe Scan 25 Jun 2023

The document is a tutorial on JavaScript that covers inserting scripts into HTML pages, creating and calling functions, manipulating the Document Object Model (DOM), and working with nodes in the DOM. It provides examples of how to dynamically change text on a webpage without reloading using event handlers, functions, and DOM manipulation with JavaScript. It also lists common comparison operators that can be used to compare data in JavaScript.

Uploaded by

naimnoman123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Javascript Scripting Tutorial

Pt3
Derek Banas

JavaScript Tutorial

In this tutorial, we will cover:

• How to insert a script into an


HTML page

• How to create and call a


function in JavaScript

• What the Document Object


Model (DOM) is and how to
manipulate it

• Working with nodes in the DOM

To insert a script into an HTML


page, you can either link to an
outside JavaScri t file or embed
the script directly into the page
itself. It's considered good form
to define the type tag, even
though browsers generally
assume that everything between
script tags is JavaScript. To block
the JavaScript code from being
seen by browsers that do not
recognize JavaScript, you can
use an HTML comment.

<!-- ... -->

To create a function in
JavaScript, start with the
keyword "function" followed by
the name you want to give it. You
can then accept variables and
perform actions on them within
the function. To manipulate the
DOM, you can use JavaScript to
access all of the objects that lie
in our HTML code. HTML
documents contain text, images,
links, CSS style tags, form
elements, etc., which are referred
to as nodes in the DOM.
JavaScript can be used to
manipulate these HTML elements
by referring to them by their
defined HTML ID name.

In the example provided, we are


creating a span with an ID of "if
span eAx" and defining what
happens when it is clicked. When
clicked, it sends the value of 1
and 4 to a function named
"testing if value". We then
manipulate the text within the
span to change its value without
having to reload the browser.
Here's a brief explanation of how
to use JavaScript to dynamically
change text on a webpage:

• First, identify the area where


you want to display the new
text

• Use the appendChild ( )

function to add a new node to


that area

• Use the createTextNode ()

function to create the new text


node

• Create an event handler using


the one 1 ic k attribute

• Pass any necessary variables


to the function that will
process the new text
When the user clicks on the
specified area, the event handler
will call the processing function
and update the text on the page
without refreshing the page.

JavaScript also provides various


comparison operators that can
be used to compare data. See
below for a list of available
operators.

That's all for now~ If you have any


questions, feel free to leave them
in the comments.

Comparison Operators in
JavaScript:

• - - - equal to

• != - not equal to
• === - equal value and equal

type

• ! == - not equal value or not


equal type

• < - less than

• > - greater than

• < = - less than or equal to

• > = - greater than or equal to

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy