SlideShare a Scribd company logo
2
Most read
6
Most read
14
Most read
Java Script
What is JavaScript?
JavaScript was designed to add interactivity to HTML
pages.
JavaScript is a scripting language.
A scripting language is a lightweight programming
language.
JavaScript is usually embedded directly into HTML
pages.
JavaScript is an interpreted language (means that
scripts execute without preliminary compilation).
Everyone can use JavaScript without purchasing a
license.
Java Script
What can a JavaScript do?
JavaScript gives HTML designers a programming tool
- HTML authors are normally not programmers, but
JavaScript is a scripting language with a very simple syntax!
Almost anyone can put small "snippets" of code into their
HTML pages.
JavaScript can put dynamic text into an HTML page - A
JavaScript statement like this:
document.write("<h1>" + name + "</h1>")
can write a variable text into an HTML page.
JavaScript can react to events - A JavaScript can be set to
execute when something happens, like when a page has
finished loading or when a user clicks on an HTML element.
JavaScript can read and write HTML elements - A
JavaScript can read and change the content of an HTML
element.
Java Script
What can a JavaScript do?
JavaScript can be used to validate data - A JavaScript can
be used to validate form data before it is submitted to a
server. This saves the server from extra processing
JavaScript can be used to detect the visitor's browser - A
JavaScript can be used to detect the visitor's browser, and depending on the browser - load another page specifically
designed for that browser
JavaScript can be used to create cookies - A JavaScript
can be used to store and retrieve information on the visitor's
computer
Features Java Script

 Statement Ends with Semicolon
 Handling Old versions of Browers
 Case Sensitive
 Ignores white space (extra space)
• i.e. “computer” and “ computer”

 Insert special characters
• i.e. document.write(“My name is “James””);
•Output:- My name is “James”

 Comments: // Single line comments
/* multi line comments…. */
Java Script
<html>
<body>
<script type="text/javascript">
document.write("This is my first JavaScript!");
</script>
</body>
</html>
Java Script
<html>
<body>
<script type="text/javascript">
document.write("<h1>Hello World!</h1>");
</script>
</body>
</html>
Java Script
<html>
<body>
<H1>
<script type="text/javascript">
document.write("Hello World!");
</script>
</H1>
</body>
</html>
Java Script
<html>
<head>
<script type="text/javascript">
document.write(“Head Section Script!");
</script>
</head>
<body>
<script type="text/javascript">
document.write(“Body Section Script!");
</script>
</body>
</html>
Java Script
External Java Script
Same script cam be use in several pages
Write the script in a separate JavaScript
file and store the file with xyz.js extension
Use the file in HTML page
Java Script
External Java Script
//External JavaScript file f1.js
document.write(“This is external Script!”);
Java Script
External Java Script
Use the file in another script
<html>
<head>
<script src=“f1.js">
</script>
</head>
<body>
<script type="text/javascript">
document.write(“Demo of External File!");
</script>
</body>
</html>
Java Script
Variables in Script
RULES:
 Case Sensitive
 Begin with Alphabet Letter or
Underscore
 Character, digit and Underscore only.
i.e.
var age = 25;
var stud_name = “james thomas”;
Java Script
Scope of Variables in Script
 Local
o variable within the function
o lifetime is till the function is in execution

 Global
o variable outside the function
o lifetime is until page closed
Java Script
Datatypes in Script

Empty
 Null
 Boolean
 Char
 Integer
 Long

 Float
 Double
 Date
 String
 Object
Java Script

ParseXXX()
Method
Self Study…
Java Script
Operators:
1) Arithmetic
2) Logical
3) Relational
4) Assignment (shorthand)
5) String
6) Bitwise
7) Conditional (Ternary)
8) Special
9) new
Java Script
Conditional Statements:
1) if
2) if else
3) Nested if
4) Switch case
Java Script
Looping/ Iteration Statements:
1) while
2) Nested while
3) Do… while
4) For
5) Nested for
6) Break
7) Continue
Java Script
<html>
<head>
<script type="text/javascript">
function message()
{
alert("This alert box was called with the onload
event");
}
</script>
</head>
<body onload="message()">
</body>
</html>

More Related Content

PPTX
Java script
Abhishek Kesharwani
 
PPTX
Java script
Shyam Khant
 
PPT
Introduction to JavaScript (1).ppt
MuhammadRehan856177
 
PDF
Javascript
Momentum Design Lab
 
PDF
TypeScript - An Introduction
NexThoughts Technologies
 
PPT
Jsp ppt
Vikas Jagtap
 
PDF
JavaScript - Chapter 7 - Advanced Functions
WebStackAcademy
 
PPT
JavaScript: Events Handling
Yuriy Bezgachnyuk
 
Java script
Abhishek Kesharwani
 
Java script
Shyam Khant
 
Introduction to JavaScript (1).ppt
MuhammadRehan856177
 
TypeScript - An Introduction
NexThoughts Technologies
 
Jsp ppt
Vikas Jagtap
 
JavaScript - Chapter 7 - Advanced Functions
WebStackAcademy
 
JavaScript: Events Handling
Yuriy Bezgachnyuk
 

What's hot (20)

PDF
jQuery for beginners
Arulmurugan Rajaraman
 
PPTX
HTML5 audio & video
Hamza Zahid
 
PPT
Javascript
mussawir20
 
PDF
Basics of JavaScript
Bala Narayanan
 
PPT
JavaScript - An Introduction
Manvendra Singh
 
PDF
Introduction into ES6 JavaScript.
boyney123
 
PDF
JavaScript - Chapter 15 - Debugging Techniques
WebStackAcademy
 
PDF
JavaScript - Chapter 12 - Document Object Model
WebStackAcademy
 
PDF
HTML CSS Basics
Mai Moustafa
 
PPSX
Javascript variables and datatypes
Varun C M
 
PDF
TypeScript Introduction
Dmitry Sheiko
 
PPT
Javascript arrays
Hassan Dar
 
PPTX
Html
Nisa Soomro
 
PPTX
Javascript 101
Shlomi Komemi
 
PPT
Javascript
guest03a6e6
 
PPT
JQuery introduction
NexThoughts Technologies
 
PPTX
Dart presentation
Lucas Leal
 
PPT
TypeScript Presentation
Patrick John Pacaña
 
PDF
JavaScript - Chapter 11 - Events
WebStackAcademy
 
PPT
01 Php Introduction
Geshan Manandhar
 
jQuery for beginners
Arulmurugan Rajaraman
 
HTML5 audio & video
Hamza Zahid
 
Javascript
mussawir20
 
Basics of JavaScript
Bala Narayanan
 
JavaScript - An Introduction
Manvendra Singh
 
Introduction into ES6 JavaScript.
boyney123
 
JavaScript - Chapter 15 - Debugging Techniques
WebStackAcademy
 
JavaScript - Chapter 12 - Document Object Model
WebStackAcademy
 
HTML CSS Basics
Mai Moustafa
 
Javascript variables and datatypes
Varun C M
 
TypeScript Introduction
Dmitry Sheiko
 
Javascript arrays
Hassan Dar
 
Javascript 101
Shlomi Komemi
 
Javascript
guest03a6e6
 
JQuery introduction
NexThoughts Technologies
 
Dart presentation
Lucas Leal
 
TypeScript Presentation
Patrick John Pacaña
 
JavaScript - Chapter 11 - Events
WebStackAcademy
 
01 Php Introduction
Geshan Manandhar
 
Ad

Similar to JavaScript - Part-1 (20)

DOC
Basics java scripts
ch samaram
 
DOC
Java script by Act Academy
actanimation
 
PPT
JAVA SCRIPT
Go4Guru
 
PPT
Java script
sanjay joshi
 
PPT
Java script
umesh patil
 
PPT
Java script
umesh patil
 
PDF
JS BASICS JAVA SCRIPT SCRIPTING
Arulkumar
 
PDF
WEB PROGRAMMING UNIT II BY BHAVSINGH MALOTH
Bhavsingh Maloth
 
PDF
Web programming UNIT II by Bhavsingh Maloth
Bhavsingh Maloth
 
DOC
Introduction to java script
nanjil1984
 
PPT
Java script202
Wasiq Zia
 
PPT
Javascript by geetanjali
Geetanjali Bhosale
 
PDF
CS8651- Unit 2 - JS.internet programming paper anna university -2017 regulation
amrashbhanuabdul
 
PDF
java-scriptcdvcx vnbm,azsdfghjkml;sxdfcgmndxfcgvhb nmfctgvbhjnm ,cfgvb nm,xc ...
kavigamage62
 
PPTX
Unit 4 Java script.pptx
Gangesh8
 
DOCX
Javascript tutorial
Abhishek Kesharwani
 
PPTX
Java script Basic
Jaya Kumari
 
DOCX
Javascript
Sushma M
 
PPTX
Java script introduction
Jesus Obenita Jr.
 
DOC
2javascript web programming with JAVA script
umardanjumamaiwada
 
Basics java scripts
ch samaram
 
Java script by Act Academy
actanimation
 
JAVA SCRIPT
Go4Guru
 
Java script
sanjay joshi
 
Java script
umesh patil
 
Java script
umesh patil
 
JS BASICS JAVA SCRIPT SCRIPTING
Arulkumar
 
WEB PROGRAMMING UNIT II BY BHAVSINGH MALOTH
Bhavsingh Maloth
 
Web programming UNIT II by Bhavsingh Maloth
Bhavsingh Maloth
 
Introduction to java script
nanjil1984
 
Java script202
Wasiq Zia
 
Javascript by geetanjali
Geetanjali Bhosale
 
CS8651- Unit 2 - JS.internet programming paper anna university -2017 regulation
amrashbhanuabdul
 
java-scriptcdvcx vnbm,azsdfghjkml;sxdfcgmndxfcgvhb nmfctgvbhjnm ,cfgvb nm,xc ...
kavigamage62
 
Unit 4 Java script.pptx
Gangesh8
 
Javascript tutorial
Abhishek Kesharwani
 
Java script Basic
Jaya Kumari
 
Javascript
Sushma M
 
Java script introduction
Jesus Obenita Jr.
 
2javascript web programming with JAVA script
umardanjumamaiwada
 
Ad

More from Jainul Musani (20)

PDF
Core Java Interface Concepts for BCA Studetns
Jainul Musani
 
PDF
Java Abstract and Final Class for BCA students
Jainul Musani
 
PDF
Java Collection Framework for BCA Students
Jainul Musani
 
PDF
Simple Calculator using JavaFx a part of Advance Java
Jainul Musani
 
PDF
JavaFx Introduction, Basic JavaFx Architecture
Jainul Musani
 
PDF
ASP.NET 2010, WebServices Full Example for BCA Students
Jainul Musani
 
PDF
Palindrome Programme in PHP for BCA students
Jainul Musani
 
PDF
Leap Year Program in PHP for BCA students
Jainul Musani
 
PDF
"PHP and MySQL CRUD Operations for Student Management System"
Jainul Musani
 
PDF
Python: The Versatile Programming Language - Introduction
Jainul Musani
 
PPTX
Python a Versatile Programming Language - Introduction
Jainul Musani
 
PDF
React js t8 - inlinecss
Jainul Musani
 
PDF
React js t7 - forms-events
Jainul Musani
 
PDF
React js t6 -lifecycle
Jainul Musani
 
PDF
React js t5 - state
Jainul Musani
 
PDF
React js t4 - components
Jainul Musani
 
PDF
React js t3 - es6
Jainul Musani
 
PDF
React js t2 - jsx
Jainul Musani
 
PDF
React js t1 - introduction
Jainul Musani
 
PPTX
ExpressJs Session01
Jainul Musani
 
Core Java Interface Concepts for BCA Studetns
Jainul Musani
 
Java Abstract and Final Class for BCA students
Jainul Musani
 
Java Collection Framework for BCA Students
Jainul Musani
 
Simple Calculator using JavaFx a part of Advance Java
Jainul Musani
 
JavaFx Introduction, Basic JavaFx Architecture
Jainul Musani
 
ASP.NET 2010, WebServices Full Example for BCA Students
Jainul Musani
 
Palindrome Programme in PHP for BCA students
Jainul Musani
 
Leap Year Program in PHP for BCA students
Jainul Musani
 
"PHP and MySQL CRUD Operations for Student Management System"
Jainul Musani
 
Python: The Versatile Programming Language - Introduction
Jainul Musani
 
Python a Versatile Programming Language - Introduction
Jainul Musani
 
React js t8 - inlinecss
Jainul Musani
 
React js t7 - forms-events
Jainul Musani
 
React js t6 -lifecycle
Jainul Musani
 
React js t5 - state
Jainul Musani
 
React js t4 - components
Jainul Musani
 
React js t3 - es6
Jainul Musani
 
React js t2 - jsx
Jainul Musani
 
React js t1 - introduction
Jainul Musani
 
ExpressJs Session01
Jainul Musani
 

Recently uploaded (20)

PPTX
Strengthening open access through collaboration: building connections with OP...
Jisc
 
PPTX
TEF & EA Bsc Nursing 5th sem.....BBBpptx
AneetaSharma15
 
PPTX
Open Quiz Monsoon Mind Game Prelims.pptx
Sourav Kr Podder
 
PDF
Types of Literary Text: Poetry and Prose
kaelandreabibit
 
PPTX
Presentation on Janskhiya sthirata kosh.
Ms Usha Vadhel
 
PDF
1.Natural-Resources-and-Their-Use.ppt pdf /8th class social science Exploring...
Sandeep Swamy
 
PPTX
Congenital Hypothyroidism pptx
AneetaSharma15
 
PPTX
Tips Management in Odoo 18 POS - Odoo Slides
Celine George
 
PPTX
How to Manage Global Discount in Odoo 18 POS
Celine George
 
PPTX
Cardiovascular Pharmacology for pharmacy students.pptx
TumwineRobert
 
PDF
2.Reshaping-Indias-Political-Map.ppt/pdf/8th class social science Exploring S...
Sandeep Swamy
 
PPTX
family health care settings home visit - unit 6 - chn 1 - gnm 1st year.pptx
Priyanshu Anand
 
PDF
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
PDF
Mga Unang Hakbang Tungo Sa Tao by Joe Vibar Nero.pdf
MariellaTBesana
 
PPTX
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
PPTX
Skill Development Program For Physiotherapy Students by SRY.pptx
Prof.Dr.Y.SHANTHOSHRAJA MPT Orthopedic., MSc Microbiology
 
PPTX
Software Engineering BSC DS UNIT 1 .pptx
Dr. Pallawi Bulakh
 
PDF
High Ground Student Revision Booklet Preview
jpinnuck
 
PPTX
ACUTE NASOPHARYNGITIS. pptx
AneetaSharma15
 
PDF
Sunset Boulevard Student Revision Booklet
jpinnuck
 
Strengthening open access through collaboration: building connections with OP...
Jisc
 
TEF & EA Bsc Nursing 5th sem.....BBBpptx
AneetaSharma15
 
Open Quiz Monsoon Mind Game Prelims.pptx
Sourav Kr Podder
 
Types of Literary Text: Poetry and Prose
kaelandreabibit
 
Presentation on Janskhiya sthirata kosh.
Ms Usha Vadhel
 
1.Natural-Resources-and-Their-Use.ppt pdf /8th class social science Exploring...
Sandeep Swamy
 
Congenital Hypothyroidism pptx
AneetaSharma15
 
Tips Management in Odoo 18 POS - Odoo Slides
Celine George
 
How to Manage Global Discount in Odoo 18 POS
Celine George
 
Cardiovascular Pharmacology for pharmacy students.pptx
TumwineRobert
 
2.Reshaping-Indias-Political-Map.ppt/pdf/8th class social science Exploring S...
Sandeep Swamy
 
family health care settings home visit - unit 6 - chn 1 - gnm 1st year.pptx
Priyanshu Anand
 
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
Mga Unang Hakbang Tungo Sa Tao by Joe Vibar Nero.pdf
MariellaTBesana
 
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
Skill Development Program For Physiotherapy Students by SRY.pptx
Prof.Dr.Y.SHANTHOSHRAJA MPT Orthopedic., MSc Microbiology
 
Software Engineering BSC DS UNIT 1 .pptx
Dr. Pallawi Bulakh
 
High Ground Student Revision Booklet Preview
jpinnuck
 
ACUTE NASOPHARYNGITIS. pptx
AneetaSharma15
 
Sunset Boulevard Student Revision Booklet
jpinnuck
 

JavaScript - Part-1

  • 1. Java Script What is JavaScript? JavaScript was designed to add interactivity to HTML pages. JavaScript is a scripting language. A scripting language is a lightweight programming language. JavaScript is usually embedded directly into HTML pages. JavaScript is an interpreted language (means that scripts execute without preliminary compilation). Everyone can use JavaScript without purchasing a license.
  • 2. Java Script What can a JavaScript do? JavaScript gives HTML designers a programming tool - HTML authors are normally not programmers, but JavaScript is a scripting language with a very simple syntax! Almost anyone can put small "snippets" of code into their HTML pages. JavaScript can put dynamic text into an HTML page - A JavaScript statement like this: document.write("<h1>" + name + "</h1>") can write a variable text into an HTML page. JavaScript can react to events - A JavaScript can be set to execute when something happens, like when a page has finished loading or when a user clicks on an HTML element. JavaScript can read and write HTML elements - A JavaScript can read and change the content of an HTML element.
  • 3. Java Script What can a JavaScript do? JavaScript can be used to validate data - A JavaScript can be used to validate form data before it is submitted to a server. This saves the server from extra processing JavaScript can be used to detect the visitor's browser - A JavaScript can be used to detect the visitor's browser, and depending on the browser - load another page specifically designed for that browser JavaScript can be used to create cookies - A JavaScript can be used to store and retrieve information on the visitor's computer
  • 4. Features Java Script  Statement Ends with Semicolon  Handling Old versions of Browers  Case Sensitive  Ignores white space (extra space) • i.e. “computer” and “ computer”  Insert special characters • i.e. document.write(“My name is “James””); •Output:- My name is “James”  Comments: // Single line comments /* multi line comments…. */
  • 5. Java Script <html> <body> <script type="text/javascript"> document.write("This is my first JavaScript!"); </script> </body> </html>
  • 8. Java Script <html> <head> <script type="text/javascript"> document.write(“Head Section Script!"); </script> </head> <body> <script type="text/javascript"> document.write(“Body Section Script!"); </script> </body> </html>
  • 9. Java Script External Java Script Same script cam be use in several pages Write the script in a separate JavaScript file and store the file with xyz.js extension Use the file in HTML page
  • 10. Java Script External Java Script //External JavaScript file f1.js document.write(“This is external Script!”);
  • 11. Java Script External Java Script Use the file in another script <html> <head> <script src=“f1.js"> </script> </head> <body> <script type="text/javascript"> document.write(“Demo of External File!"); </script> </body> </html>
  • 12. Java Script Variables in Script RULES:  Case Sensitive  Begin with Alphabet Letter or Underscore  Character, digit and Underscore only. i.e. var age = 25; var stud_name = “james thomas”;
  • 13. Java Script Scope of Variables in Script  Local o variable within the function o lifetime is till the function is in execution  Global o variable outside the function o lifetime is until page closed
  • 14. Java Script Datatypes in Script Empty  Null  Boolean  Char  Integer  Long  Float  Double  Date  String  Object
  • 16. Java Script Operators: 1) Arithmetic 2) Logical 3) Relational 4) Assignment (shorthand) 5) String 6) Bitwise 7) Conditional (Ternary) 8) Special 9) new
  • 17. Java Script Conditional Statements: 1) if 2) if else 3) Nested if 4) Switch case
  • 18. Java Script Looping/ Iteration Statements: 1) while 2) Nested while 3) Do… while 4) For 5) Nested for 6) Break 7) Continue
  • 19. Java Script <html> <head> <script type="text/javascript"> function message() { alert("This alert box was called with the onload event"); } </script> </head> <body onload="message()"> </body> </html>