SlideShare a Scribd company logo
JavaScript Tutorial
• JavaScript is a language that adds functionality and interactivity to
websites. While HTML can create a web page, and CSS can customize its
appearance, the page will be static. It won’t do anything.
• How do you fix that? JavaScript! JavaScript makes many things possible on
web pages. It responds to user events like clicks, hovers or key presses. It
changes HTML, changes CSS and makes web pages interactive.
• Like CSS, there are three ways that JavaScript is embedded on web pages –
inline, internal and external.
Inline JavaScript
• When embedding inline CSS in an HTML tag, websites use the style
attribute. When embedding inline JavaScript however, there are a
number of attributes that are used.
• One of these attributes is onclick. Any JavaScript code inside an
onclick attribute gets executed when the HTML element is clicked.
• The inner text of the below <strong> tag is currently ‘Text’. JavaScript
will change the inner text to ‘Bold Text’ when the element is clicked.
• <strong> onclick="this.innerText = 'Bold Text';">Text</strong>
• Text
Internal JavaScript
• Like CSS, inline JavaScript is uncommon. Often, websites have scripts that
involve multiple HTML elements, so they tend to collect them all up and
place them together in one big script, using the HTML <script> tag.
• <script>
• var num = 142857;
• document.getElementById('bold').innerText = num;
• </script>
• The <script> tag is often placed as the last element inside a website’s
<body>. This is so that all the HTML elements can fully load before they get
transformed by the JavaScript.
External JavaScript
• Often, a website will have its JavaScript in a separate file called
script.js. This allows the site to use the same script on multiple web
pages. Here’s how a website would link to an external JavaScript file,
assuming the file name is script.js:
• <script src="script.js"></script>
• Like with internal JavaScript, this tag is often placed near the end of
the <body> element on a web page.
Want More JavaScript?
• There’s only so much this tutorial can cover. If you want to take JavaScript
further, there’s plenty of extensive JavaScript training available.
• There are some great providers of online JavaScript training like Treehouse
and Codecademy. There are also plenty of great books on JavaScript, such
as JavaScript: The Definitive Guide and JavaScript: The Good Parts.
• See all JavaScript training recommendations…
• Stick around for the next tutorial, and you’ll learn how to write more
simple scripts with PHP.

More Related Content

ODP
Css,javascript,php,mysql
PPTX
jQuery - Web Engineering
PDF
Wordpress as a Backend
PPTX
Introduction to Jquery
PDF
Word press workshop powerpoint
PPT
Html intro
PDF
Best Practices for Building Sites in dotCMS
PPTX
Introduction To JavaScript Ajax
Css,javascript,php,mysql
jQuery - Web Engineering
Wordpress as a Backend
Introduction to Jquery
Word press workshop powerpoint
Html intro
Best Practices for Building Sites in dotCMS
Introduction To JavaScript Ajax

What's hot (20)

PDF
WordPress & Backbone.js
PPT
Club website demo
PPTX
Javascript
PDF
PDF
PDF
WordCamp Tokyo 2011 komori
PDF
PDF
Using html5 to build offline applications
PPTX
Super quick introduction to html5
PPTX
Multi-content Containers in dotCMS 3.0
PPTX
How to Boost the performance of your Wordpress powered websites
PDF
PDF
Modern web application devlopment workflow
PDF
Forms as Structured Content
PPTX
Gatsby intro
PDF
LESS is More (ChiHTML5 Meetup June 2016)
PDF
Modern Static Site with GatsbyJS
PPT
Dreamweaver
PPTX
Week01 jan19 introductionto_php
WordPress & Backbone.js
Club website demo
Javascript
WordCamp Tokyo 2011 komori
Using html5 to build offline applications
Super quick introduction to html5
Multi-content Containers in dotCMS 3.0
How to Boost the performance of your Wordpress powered websites
Modern web application devlopment workflow
Forms as Structured Content
Gatsby intro
LESS is More (ChiHTML5 Meetup June 2016)
Modern Static Site with GatsbyJS
Dreamweaver
Week01 jan19 introductionto_php
Ad

Similar to Java script tutorial (20)

PPTX
JavaScript - Getting Started.pptx
PDF
Instagram filters (8 24)
PDF
JS BASICS JAVA SCRIPT SCRIPTING
PDF
Instagram filters (8 24)
PPTX
Javascript
PPTX
pras ppjznsms zkskmssia znjzmsmsmkM JKamens
PPTX
Web development basics
PPT
Java script202
PPTX
Java script
PDF
CS8651- Unit 2 - JS.internet programming paper anna university -2017 regulation
PPTX
Js placement
PDF
Html css crash course may 11th, atlanta
PDF
Essential_Javascript_--_A_Javascript_Tutorial
PDF
Essential Javascript -- A Javascript &lt;b>Tutorial&lt;/b>
PDF
Essential_Javascript_--_A_Javascript_Tutorial
PDF
&lt;img src="../i/r_14.png" />
DOC
Java script by Act Academy
PPT
Java script
PPT
Java script
PPTX
Bootcamp - Web Development Session 2
JavaScript - Getting Started.pptx
Instagram filters (8 24)
JS BASICS JAVA SCRIPT SCRIPTING
Instagram filters (8 24)
Javascript
pras ppjznsms zkskmssia znjzmsmsmkM JKamens
Web development basics
Java script202
Java script
CS8651- Unit 2 - JS.internet programming paper anna university -2017 regulation
Js placement
Html css crash course may 11th, atlanta
Essential_Javascript_--_A_Javascript_Tutorial
Essential Javascript -- A Javascript &lt;b>Tutorial&lt;/b>
Essential_Javascript_--_A_Javascript_Tutorial
&lt;img src="../i/r_14.png" />
Java script by Act Academy
Java script
Java script
Bootcamp - Web Development Session 2
Ad

More from Son Nguyen (20)

PPTX
Your new maven friend – the mule maven
PPTX
Soa governance for the modern business
PPTX
Quality sdk for your apis in minutes!
PPTX
Maven tools & archetypes
PPTX
Let api change your relationship with your doctor
PPTX
Increase revenue and reinvigorate your business with api
PPTX
How to – wrap soap web service around a database
PPTX
How to – rest api proxy to soap webservice
PPTX
Anypoint runtime manager v1
PPTX
A good api strategy can help turn your
PPTX
10 steps to design and build the perfect
PPTX
What is the difference between using private flow
PPTX
Troubleshooting mule
PPTX
Running mule as worker role on azure
PPTX
Real time data processing with anypoint connector for kafka
PPTX
Performance tuning in mule
PPTX
Mule intelli j tips
PPTX
Introducing the anypoint connector for redis
PPTX
How to – data integrity checks in batch processing
PPTX
How soa paved the way for cloud
Your new maven friend – the mule maven
Soa governance for the modern business
Quality sdk for your apis in minutes!
Maven tools & archetypes
Let api change your relationship with your doctor
Increase revenue and reinvigorate your business with api
How to – wrap soap web service around a database
How to – rest api proxy to soap webservice
Anypoint runtime manager v1
A good api strategy can help turn your
10 steps to design and build the perfect
What is the difference between using private flow
Troubleshooting mule
Running mule as worker role on azure
Real time data processing with anypoint connector for kafka
Performance tuning in mule
Mule intelli j tips
Introducing the anypoint connector for redis
How to – data integrity checks in batch processing
How soa paved the way for cloud

Recently uploaded (20)

PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Cloud computing and distributed systems.
PDF
Encapsulation theory and applications.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Empathic Computing: Creating Shared Understanding
PDF
cuic standard and advanced reporting.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Big Data Technologies - Introduction.pptx
PPTX
A Presentation on Artificial Intelligence
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Chapter 3 Spatial Domain Image Processing.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
NewMind AI Weekly Chronicles - August'25 Week I
Cloud computing and distributed systems.
Encapsulation theory and applications.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
Empathic Computing: Creating Shared Understanding
cuic standard and advanced reporting.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Big Data Technologies - Introduction.pptx
A Presentation on Artificial Intelligence
Encapsulation_ Review paper, used for researhc scholars
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Review of recent advances in non-invasive hemoglobin estimation
Reach Out and Touch Someone: Haptics and Empathic Computing
Network Security Unit 5.pdf for BCA BBA.
Diabetes mellitus diagnosis method based random forest with bat algorithm
Per capita expenditure prediction using model stacking based on satellite ima...
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...

Java script tutorial

  • 2. • JavaScript is a language that adds functionality and interactivity to websites. While HTML can create a web page, and CSS can customize its appearance, the page will be static. It won’t do anything. • How do you fix that? JavaScript! JavaScript makes many things possible on web pages. It responds to user events like clicks, hovers or key presses. It changes HTML, changes CSS and makes web pages interactive. • Like CSS, there are three ways that JavaScript is embedded on web pages – inline, internal and external.
  • 3. Inline JavaScript • When embedding inline CSS in an HTML tag, websites use the style attribute. When embedding inline JavaScript however, there are a number of attributes that are used. • One of these attributes is onclick. Any JavaScript code inside an onclick attribute gets executed when the HTML element is clicked. • The inner text of the below <strong> tag is currently ‘Text’. JavaScript will change the inner text to ‘Bold Text’ when the element is clicked.
  • 4. • <strong> onclick="this.innerText = 'Bold Text';">Text</strong> • Text
  • 5. Internal JavaScript • Like CSS, inline JavaScript is uncommon. Often, websites have scripts that involve multiple HTML elements, so they tend to collect them all up and place them together in one big script, using the HTML <script> tag. • <script> • var num = 142857; • document.getElementById('bold').innerText = num; • </script> • The <script> tag is often placed as the last element inside a website’s <body>. This is so that all the HTML elements can fully load before they get transformed by the JavaScript.
  • 6. External JavaScript • Often, a website will have its JavaScript in a separate file called script.js. This allows the site to use the same script on multiple web pages. Here’s how a website would link to an external JavaScript file, assuming the file name is script.js: • <script src="script.js"></script> • Like with internal JavaScript, this tag is often placed near the end of the <body> element on a web page.
  • 7. Want More JavaScript? • There’s only so much this tutorial can cover. If you want to take JavaScript further, there’s plenty of extensive JavaScript training available. • There are some great providers of online JavaScript training like Treehouse and Codecademy. There are also plenty of great books on JavaScript, such as JavaScript: The Definitive Guide and JavaScript: The Good Parts. • See all JavaScript training recommendations… • Stick around for the next tutorial, and you’ll learn how to write more simple scripts with PHP.