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.
Ad

Recommended

Css,javascript,php,mysql
Css,javascript,php,mysql
vurimi prasad
 
jQuery - Web Engineering
jQuery - Web Engineering
adeel990
 
Wordpress as a Backend
Wordpress as a Backend
Andrew Duthie
 
Introduction to Jquery
Introduction to Jquery
Gurpreet singh
 
Word press workshop powerpoint
Word press workshop powerpoint
erezwe
 
Html intro
Html intro
Danielle Oser, APR
 
Best Practices for Building Sites in dotCMS
Best Practices for Building Sites in dotCMS
Michael Fienen
 
Introduction To JavaScript Ajax
Introduction To JavaScript Ajax
Reema
 
WordPress & Backbone.js
WordPress & Backbone.js
Andrew Duthie
 
Club website demo
Club website demo
blstov
 
Javascript
Javascript
Ekansh Purwar
 
Tf ffccjs
Tf ffccjs
Shannon Gallagher
 
Tf frccjs
Tf frccjs
Shannon Gallagher
 
WordCamp Tokyo 2011 komori
WordCamp Tokyo 2011 komori
masaaki komori
 
Tf ffccjs
Tf ffccjs
Shannon Gallagher
 
Using html5 to build offline applications
Using html5 to build offline applications
Woody Pewitt
 
Super quick introduction to html5
Super quick introduction to html5
Woody Pewitt
 
Ajax
Ajax
baabtra.com - No. 1 supplier of quality freshers
 
Multi-content Containers in dotCMS 3.0
Multi-content Containers in dotCMS 3.0
Jason Smith
 
How to Boost the performance of your Wordpress powered websites
How to Boost the performance of your Wordpress powered websites
Pratik Jagdishwala
 
Html5
Html5
shaifymehtadnn
 
Modern web application devlopment workflow
Modern web application devlopment workflow
Hamdi Hmidi
 
Forms as Structured Content
Forms as Structured Content
dotCMS
 
Gatsby intro
Gatsby intro
Ben McCormick
 
LESS is More (ChiHTML5 Meetup June 2016)
LESS is More (ChiHTML5 Meetup June 2016)
Sara Laupp
 
Modern Static Site with GatsbyJS
Modern Static Site with GatsbyJS
Riza Fahmi
 
Dreamweaver
Dreamweaver
Umamaheshwariv1
 
Week01 jan19 introductionto_php
Week01 jan19 introductionto_php
Jeanho Chu
 
JavaScript - Getting Started.pptx
JavaScript - Getting Started.pptx
JonnJorellPunto
 
Instagram filters (8 24)
Instagram filters (8 24)
Ivy Rueb
 

More Related Content

What's hot (20)

WordPress & Backbone.js
WordPress & Backbone.js
Andrew Duthie
 
Club website demo
Club website demo
blstov
 
Javascript
Javascript
Ekansh Purwar
 
Tf ffccjs
Tf ffccjs
Shannon Gallagher
 
Tf frccjs
Tf frccjs
Shannon Gallagher
 
WordCamp Tokyo 2011 komori
WordCamp Tokyo 2011 komori
masaaki komori
 
Tf ffccjs
Tf ffccjs
Shannon Gallagher
 
Using html5 to build offline applications
Using html5 to build offline applications
Woody Pewitt
 
Super quick introduction to html5
Super quick introduction to html5
Woody Pewitt
 
Ajax
Ajax
baabtra.com - No. 1 supplier of quality freshers
 
Multi-content Containers in dotCMS 3.0
Multi-content Containers in dotCMS 3.0
Jason Smith
 
How to Boost the performance of your Wordpress powered websites
How to Boost the performance of your Wordpress powered websites
Pratik Jagdishwala
 
Html5
Html5
shaifymehtadnn
 
Modern web application devlopment workflow
Modern web application devlopment workflow
Hamdi Hmidi
 
Forms as Structured Content
Forms as Structured Content
dotCMS
 
Gatsby intro
Gatsby intro
Ben McCormick
 
LESS is More (ChiHTML5 Meetup June 2016)
LESS is More (ChiHTML5 Meetup June 2016)
Sara Laupp
 
Modern Static Site with GatsbyJS
Modern Static Site with GatsbyJS
Riza Fahmi
 
Dreamweaver
Dreamweaver
Umamaheshwariv1
 
Week01 jan19 introductionto_php
Week01 jan19 introductionto_php
Jeanho Chu
 
WordPress & Backbone.js
WordPress & Backbone.js
Andrew Duthie
 
Club website demo
Club website demo
blstov
 
WordCamp Tokyo 2011 komori
WordCamp Tokyo 2011 komori
masaaki komori
 
Using html5 to build offline applications
Using html5 to build offline applications
Woody Pewitt
 
Super quick introduction to html5
Super quick introduction to html5
Woody Pewitt
 
Multi-content Containers in dotCMS 3.0
Multi-content Containers in dotCMS 3.0
Jason Smith
 
How to Boost the performance of your Wordpress powered websites
How to Boost the performance of your Wordpress powered websites
Pratik Jagdishwala
 
Modern web application devlopment workflow
Modern web application devlopment workflow
Hamdi Hmidi
 
Forms as Structured Content
Forms as Structured Content
dotCMS
 
LESS is More (ChiHTML5 Meetup June 2016)
LESS is More (ChiHTML5 Meetup June 2016)
Sara Laupp
 
Modern Static Site with GatsbyJS
Modern Static Site with GatsbyJS
Riza Fahmi
 
Week01 jan19 introductionto_php
Week01 jan19 introductionto_php
Jeanho Chu
 

Similar to Java script tutorial (20)

JavaScript - Getting Started.pptx
JavaScript - Getting Started.pptx
JonnJorellPunto
 
Instagram filters (8 24)
Instagram filters (8 24)
Ivy Rueb
 
JS BASICS JAVA SCRIPT SCRIPTING
JS BASICS JAVA SCRIPT SCRIPTING
Arulkumar
 
Instagram filters (8 24)
Instagram filters (8 24)
Ivy Rueb
 
Javascript
Javascript
Mozxai
 
pras ppjznsms zkskmssia znjzmsmsmkM JKamens
pras ppjznsms zkskmssia znjzmsmsmkM JKamens
RudreshPvb
 
Web development basics
Web development basics
Kalluri Vinay Reddy
 
Java script202
Java script202
Wasiq Zia
 
Java script
Java script
Abhishek Kesharwani
 
CS8651- Unit 2 - JS.internet programming paper anna university -2017 regulation
CS8651- Unit 2 - JS.internet programming paper anna university -2017 regulation
amrashbhanuabdul
 
Js placement
Js placement
Sireesh K
 
Html css crash course may 11th, atlanta
Html css crash course may 11th, atlanta
Thinkful
 
Essential Javascript -- A Javascript &lt;b>Tutorial&lt;/b>
Essential Javascript -- A Javascript &lt;b>Tutorial&lt;/b>
tutorialsruby
 
Essential_Javascript_--_A_Javascript_Tutorial
Essential_Javascript_--_A_Javascript_Tutorial
tutorialsruby
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
tutorialsruby
 
Essential_Javascript_--_A_Javascript_Tutorial
Essential_Javascript_--_A_Javascript_Tutorial
tutorialsruby
 
Java script by Act Academy
Java script by Act Academy
actanimation
 
Java script
Java script
sanjay joshi
 
Java script
Java script
umesh patil
 
Bootcamp - Web Development Session 2
Bootcamp - Web Development Session 2
GDSCUniversitasMatan
 
JavaScript - Getting Started.pptx
JavaScript - Getting Started.pptx
JonnJorellPunto
 
Instagram filters (8 24)
Instagram filters (8 24)
Ivy Rueb
 
JS BASICS JAVA SCRIPT SCRIPTING
JS BASICS JAVA SCRIPT SCRIPTING
Arulkumar
 
Instagram filters (8 24)
Instagram filters (8 24)
Ivy Rueb
 
Javascript
Javascript
Mozxai
 
pras ppjznsms zkskmssia znjzmsmsmkM JKamens
pras ppjznsms zkskmssia znjzmsmsmkM JKamens
RudreshPvb
 
Java script202
Java script202
Wasiq Zia
 
CS8651- Unit 2 - JS.internet programming paper anna university -2017 regulation
CS8651- Unit 2 - JS.internet programming paper anna university -2017 regulation
amrashbhanuabdul
 
Js placement
Js placement
Sireesh K
 
Html css crash course may 11th, atlanta
Html css crash course may 11th, atlanta
Thinkful
 
Essential Javascript -- A Javascript &lt;b>Tutorial&lt;/b>
Essential Javascript -- A Javascript &lt;b>Tutorial&lt;/b>
tutorialsruby
 
Essential_Javascript_--_A_Javascript_Tutorial
Essential_Javascript_--_A_Javascript_Tutorial
tutorialsruby
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
tutorialsruby
 
Essential_Javascript_--_A_Javascript_Tutorial
Essential_Javascript_--_A_Javascript_Tutorial
tutorialsruby
 
Java script by Act Academy
Java script by Act Academy
actanimation
 
Bootcamp - Web Development Session 2
Bootcamp - Web Development Session 2
GDSCUniversitasMatan
 
Ad

More from Son Nguyen (20)

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

Recently uploaded (20)

The Future of Data, AI, and AR: Innovation Inspired by You.pdf
The Future of Data, AI, and AR: Innovation Inspired by You.pdf
Safe Software
 
The Future of AI Agent Development Trends to Watch.pptx
The Future of AI Agent Development Trends to Watch.pptx
Lisa ward
 
Securing AI - There Is No Try, Only Do!.pdf
Securing AI - There Is No Try, Only Do!.pdf
Priyanka Aash
 
OWASP Barcelona 2025 Threat Model Library
OWASP Barcelona 2025 Threat Model Library
PetraVukmirovic
 
Cyber Defense Matrix Workshop - RSA Conference
Cyber Defense Matrix Workshop - RSA Conference
Priyanka Aash
 
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
Priyanka Aash
 
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Alliance
 
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
 
GenAI Opportunities and Challenges - Where 370 Enterprises Are Focusing Now.pdf
GenAI Opportunities and Challenges - Where 370 Enterprises Are Focusing Now.pdf
Priyanka Aash
 
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Alliance
 
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
 
Oh, the Possibilities - Balancing Innovation and Risk with Generative AI.pdf
Oh, the Possibilities - Balancing Innovation and Risk with Generative AI.pdf
Priyanka Aash
 
You are not excused! How to avoid security blind spots on the way to production
You are not excused! How to avoid security blind spots on the way to production
Michele Leroux Bustamante
 
AI VIDEO MAGAZINE - June 2025 - r/aivideo
AI VIDEO MAGAZINE - June 2025 - r/aivideo
1pcity Studios, Inc
 
Securing Account Lifecycles in the Age of Deepfakes.pptx
Securing Account Lifecycles in the Age of Deepfakes.pptx
FIDO Alliance
 
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC
 
The Future of Technology: 2025-2125 by Saikat Basu.pdf
The Future of Technology: 2025-2125 by Saikat Basu.pdf
Saikat Basu
 
Information Security Response Team Nepal_npCERT_Vice_President_Sudan_Jha.pdf
Information Security Response Team Nepal_npCERT_Vice_President_Sudan_Jha.pdf
ICT Frame Magazine Pvt. Ltd.
 
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Safe Software
 
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
 
The Future of Data, AI, and AR: Innovation Inspired by You.pdf
The Future of Data, AI, and AR: Innovation Inspired by You.pdf
Safe Software
 
The Future of AI Agent Development Trends to Watch.pptx
The Future of AI Agent Development Trends to Watch.pptx
Lisa ward
 
Securing AI - There Is No Try, Only Do!.pdf
Securing AI - There Is No Try, Only Do!.pdf
Priyanka Aash
 
OWASP Barcelona 2025 Threat Model Library
OWASP Barcelona 2025 Threat Model Library
PetraVukmirovic
 
Cyber Defense Matrix Workshop - RSA Conference
Cyber Defense Matrix Workshop - RSA Conference
Priyanka Aash
 
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
Priyanka Aash
 
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Alliance
 
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
 
GenAI Opportunities and Challenges - Where 370 Enterprises Are Focusing Now.pdf
GenAI Opportunities and Challenges - Where 370 Enterprises Are Focusing Now.pdf
Priyanka Aash
 
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Alliance
 
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
 
Oh, the Possibilities - Balancing Innovation and Risk with Generative AI.pdf
Oh, the Possibilities - Balancing Innovation and Risk with Generative AI.pdf
Priyanka Aash
 
You are not excused! How to avoid security blind spots on the way to production
You are not excused! How to avoid security blind spots on the way to production
Michele Leroux Bustamante
 
AI VIDEO MAGAZINE - June 2025 - r/aivideo
AI VIDEO MAGAZINE - June 2025 - r/aivideo
1pcity Studios, Inc
 
Securing Account Lifecycles in the Age of Deepfakes.pptx
Securing Account Lifecycles in the Age of Deepfakes.pptx
FIDO Alliance
 
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC
 
The Future of Technology: 2025-2125 by Saikat Basu.pdf
The Future of Technology: 2025-2125 by Saikat Basu.pdf
Saikat Basu
 
Information Security Response Team Nepal_npCERT_Vice_President_Sudan_Jha.pdf
Information Security Response Team Nepal_npCERT_Vice_President_Sudan_Jha.pdf
ICT Frame Magazine Pvt. Ltd.
 
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Safe Software
 
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
 

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.