SlideShare a Scribd company logo
1. JavaScript Overview
What is JavaScript ?
๏ฑ JavaScript started life as LiveScript, but Netscape changed the
name, possibly because of the excitement being generated by
Java.to JavaScript. JavaScript made its first appearance in
Netscape 2.0 in 1995 with a name LiveScript.
๏ฑ JavaScript is a lightweight, interpreted programming language
with object-oriented capabilities that allows you to build
interactivity into otherwise static HTML pages.
๏ฑ The general-purpose core of the language has been embedded
in Netscape, Internet Explorer, and other web browsers
JavaScript is:
๏ฑ JavaScript is a lightweight, interpreted programming language
๏ฑ Designed for creating network-centric applications
๏ฑ Complementary to and integrated with Java
๏ฑ Complementary to and integrated with HTML
๏ฑ Open and cross-platform
๏ฑ Client-side JavaScript is the most common form of the
language. The script should be included in or referenced by an
HTML document for the code to be interpreted by the browser.
๏ฑ It means that a web page need no longer be static HTML, but
can include programs that interact with the user, control the
browser, and dynamically create HTML content.
๏ฑ The JavaScript code is executed when the user submits the
form, and only if all the entries are valid they would be
submitted to the Web Server.
๏ฑ JavaScript can be used to trap user-initiated events such as
button clicks, link navigation, and other actions that the user
explicitly or implicitly initiates.
Client-side JavaScript:
Advantages of JavaScript:
The merits of using JavaScript are:
๏ฑ Less server interaction: You can validate user input before
sending the page off to the server. This saves server traffic,
which means less load on your server.
๏ฑ Immediate feedback to the visitors: They don't have to wait
for a page reload to see if they have forgotten to enter
something.
๏ฑ Increased interactivity: You can create interfaces that react
when the user hovers over them with a mouse or activates
them via the keyboard.
๏ฑ Richer interfaces: You can use JavaScript to include such items
as drag-and-drop components and sliders to give a Rich
Interface to your site visitors.
Limitations with JavaScript:
๏ฑ We can not treat JavaScript as a full fledged programming
language. It lacks the following important features:
๏ฑ Client-side JavaScript does not allow the reading or writing of
files. This has been kept for security reason.
๏ฑ JavaScript can not be used for Networking applications because
there is no such support available.
๏ฑ JavaScript doesn't have any multithreading or multiprocess
capabilities.
JavaScript Development Tools:
๏ฑ One of JavaScript's strengths is that expensive development
tools are not usually required. You can start with a simple text
editor such as Notepad.
๏ฑ Since it is an interpreted language inside the context of a web
browser, you don't even need to buy a compiler.
๏ฑ To make our life simpler, various vendors have come up with
very nice JavaScript editing tools. Few of them are listed here:
โ€“ Microsoft FrontPage
โ€“ Macromedia Dreamweaver MX
โ€“ Macromedia HomeSite 5
โ€“ Yaldex Software Inc., Free JavaScript Editor
2. JavaScript Syntax
๏ฑ A JavaScript consists of JavaScript statements that are placed within
the <script>... </script> HTML tags in a web page.
๏ฑ You can place the <script> tag containing your JavaScript anywhere
within you web page but it is preferred way to keep it within the
<head> tags.
๏ฑ The <script> tag alert the browser program to begin interpreting all
the text between these tags as a script. So simple syntax of your
JavaScript will be as follows (next slide)
<script language="javascript"
type="text/javascript">
JavaScript code
</script>
The script tag takes two important attributes:
๏ฑ language: This attribute specifies what scripting language you are
using. Typically, its value will be javascript. Although recent versions of
HTML (and XHTML, its successor) have phased out the use of this
attribute.
๏ฑ type: This attribute is what is now recommended to indicate the
scripting language in use and its value should be set to "text/javascript".
Your First JavaScript Script:
<html>
<body>
<script language="javascript"
type="text/javascript">
<!--
document.write("Hello World!")
//-->
</script>
</body>
</html>
๏ฑ JavaScript ignores spaces, tabs, and newlines that appear in
JavaScript programs.
๏ฑ Because you can use spaces, tabs, and newlines freely in your
program so you are free to format and indent your programs in
a neat and consistent way that makes the code easy to read
and understand.
Semicolons are Optional:
๏ฑ Simple statements in JavaScript are generally followed by a
semicolon character, just as they are in C, C++, and Java.
JavaScript, however, allows you to omit this semicolon if your
statements are each placed on a separate line. For example, the
following code could be written without semicolons
Whitespace and Line Breaks:
โ€ข JavaScript is a case-sensitive language. This means that
language keywords, variables, function names, and any other
identifiers must always be typed with a consistent capitalization
of letters.
โ€ข So identifiers Time, TIme and TIME will have different meanings
in JavaScript.
โ€ข NOTE: Care should be taken while writing your variable and
function names in JavaScript.
Case Sensitivity:
Comments in JavaScript:
โ€ข JavaScript supports both C-style and C++-style comments, Thus:
โ€ข Any text between a // and the end of a line is treated as a
comment and is ignored by JavaScript.
โ€ข Any text between the characters /* and */ is treated as a
comment. This may span multiple lines.
โ€ข JavaScript also recognizes the HTML comment opening
sequence <!--. JavaScript treats this as a single-line comment,
just as it does the // comment.
โ€ข The HTML comment closing sequence --> is not recognized by
JavaScript so it should be written as //-->.
Example 1:
<script language="javascript" type="text/javascript">
<!--
// This is a comment. It is similar to comments in C+
+
/*
* This is a multiline comment in JavaScript
* It is very similar to comments in C Programming
*/
//-->
</script>
Example 2:
<html>
<head>
<script>
function displayDate()
{
document.getElementById("demo").innerHTML=Date();
}
</script>
</head>
<body>
<h1>My First JavaScript</h1>
<p id="demo">This is a paragraph.</p>
<button type="button" onclick="displayDate()">Display
Date</button>
</body>
</html>
Ad

Recommended

Javascript tutorial
Javascript tutorial
Abhishek Kesharwani
ย 
Javascript tutorial
Javascript tutorial
Abhishek Kesharwani
ย 
JavaScript New Tutorial Class XI and XII.pptx
JavaScript New Tutorial Class XI and XII.pptx
rish15r890
ย 
JavaScript New Tutorial Class XI and XII.pptx
JavaScript New Tutorial Class XI and XII.pptx
rish15r890
ย 
WEB PROGRAMMING UNIT II BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT II BY BHAVSINGH MALOTH
Bhavsingh Maloth
ย 
Web programming UNIT II by Bhavsingh Maloth
Web programming UNIT II by Bhavsingh Maloth
Bhavsingh Maloth
ย 
WEB PROGRAMMING UNIT II BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT II BY BHAVSINGH MALOTH
Bhavsingh Maloth
ย 
Web programming UNIT II by Bhavsingh Maloth
Web programming UNIT II by Bhavsingh Maloth
Bhavsingh Maloth
ย 
Unit 4 Java script.pptx
Unit 4 Java script.pptx
Gangesh8
ย 
Unit 4 Java script.pptx
Unit 4 Java script.pptx
Gangesh8
ย 
Introduction to JavaScript
Introduction to JavaScript
ApxicTechnologies1
ย 
Introduction to JavaScript
Introduction to JavaScript
ApxicTechnologies1
ย 
Java script
Java script
umesh patil
ย 
Java script
Java script
umesh patil
ย 
Java script Basic
Java script Basic
Jaya Kumari
ย 
Java script Basic
Java script Basic
Jaya Kumari
ย 
JAVA SCRIPT
JAVA SCRIPT
Go4Guru
ย 
JAVA SCRIPT
JAVA SCRIPT
Go4Guru
ย 
Basics java scripts
Basics java scripts
ch samaram
ย 
Basics java scripts
Basics java scripts
ch samaram
ย 
Js syntax
Js syntax
Sireesh K
ย 
Js syntax
Js syntax
Sireesh K
ย 
Java script by Act Academy
Java script by Act Academy
actanimation
ย 
Java script by Act Academy
Java script by Act Academy
actanimation
ย 
introduction to js
introduction to js
Sireesh K
ย 
introduction to js
introduction to js
Sireesh K
ย 
web designing course bangalore
web designing course bangalore
Infocampus Logics Pvt.Ltd.
ย 
web designing course bangalore
web designing course bangalore
Infocampus Logics Pvt.Ltd.
ย 
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
ย 
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.
ย 

More Related Content

Similar to java script programming slide 1 from tn state (20)

Unit 4 Java script.pptx
Unit 4 Java script.pptx
Gangesh8
ย 
Unit 4 Java script.pptx
Unit 4 Java script.pptx
Gangesh8
ย 
Introduction to JavaScript
Introduction to JavaScript
ApxicTechnologies1
ย 
Introduction to JavaScript
Introduction to JavaScript
ApxicTechnologies1
ย 
Java script
Java script
umesh patil
ย 
Java script
Java script
umesh patil
ย 
Java script Basic
Java script Basic
Jaya Kumari
ย 
Java script Basic
Java script Basic
Jaya Kumari
ย 
JAVA SCRIPT
JAVA SCRIPT
Go4Guru
ย 
JAVA SCRIPT
JAVA SCRIPT
Go4Guru
ย 
Basics java scripts
Basics java scripts
ch samaram
ย 
Basics java scripts
Basics java scripts
ch samaram
ย 
Js syntax
Js syntax
Sireesh K
ย 
Js syntax
Js syntax
Sireesh K
ย 
Java script by Act Academy
Java script by Act Academy
actanimation
ย 
Java script by Act Academy
Java script by Act Academy
actanimation
ย 
introduction to js
introduction to js
Sireesh K
ย 
introduction to js
introduction to js
Sireesh K
ย 
web designing course bangalore
web designing course bangalore
Infocampus Logics Pvt.Ltd.
ย 
web designing course bangalore
web designing course bangalore
Infocampus Logics Pvt.Ltd.
ย 
Unit 4 Java script.pptx
Unit 4 Java script.pptx
Gangesh8
ย 
Unit 4 Java script.pptx
Unit 4 Java script.pptx
Gangesh8
ย 
Introduction to JavaScript
Introduction to JavaScript
ApxicTechnologies1
ย 
Introduction to JavaScript
Introduction to JavaScript
ApxicTechnologies1
ย 
Java script
Java script
umesh patil
ย 
Java script
Java script
umesh patil
ย 
Java script Basic
Java script Basic
Jaya Kumari
ย 
Java script Basic
Java script Basic
Jaya Kumari
ย 
JAVA SCRIPT
JAVA SCRIPT
Go4Guru
ย 
JAVA SCRIPT
JAVA SCRIPT
Go4Guru
ย 
Basics java scripts
Basics java scripts
ch samaram
ย 
Basics java scripts
Basics java scripts
ch samaram
ย 
Js syntax
Js syntax
Sireesh K
ย 
Js syntax
Js syntax
Sireesh K
ย 
Java script by Act Academy
Java script by Act Academy
actanimation
ย 
Java script by Act Academy
Java script by Act Academy
actanimation
ย 
introduction to js
introduction to js
Sireesh K
ย 
introduction to js
introduction to js
Sireesh K
ย 

Recently uploaded (20)

CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
ย 
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.
ย 
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
caoyixuan2019
ย 
Securing Account Lifecycles in the Age of Deepfakes.pptx
Securing Account Lifecycles in the Age of Deepfakes.pptx
FIDO Alliance
ย 
OpenPOWER Foundation & Open-Source Core Innovations
OpenPOWER Foundation & Open-Source Core Innovations
IBM
ย 
The Future of Technology: 2025-2125 by Saikat Basu.pdf
The Future of Technology: 2025-2125 by Saikat Basu.pdf
Saikat Basu
ย 
Python Conference Singapore - 19 Jun 2025
Python Conference Singapore - 19 Jun 2025
ninefyi
ย 
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Priyanka Aash
ย 
9-1-1 Addressing: End-to-End Automation Using FME
9-1-1 Addressing: End-to-End Automation Using FME
Safe Software
ย 
Powering Multi-Page Web Applications Using Flow Apps and FME Data Streaming
Powering Multi-Page Web Applications Using Flow Apps and FME Data Streaming
Safe Software
ย 
cnc-processing-centers-centateq-p-110-en.pdf
cnc-processing-centers-centateq-p-110-en.pdf
AmirStern2
ย 
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
ย 
Oh, the Possibilities - Balancing Innovation and Risk with Generative AI.pdf
Oh, the Possibilities - Balancing Innovation and Risk with Generative AI.pdf
Priyanka Aash
ย 
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Safe Software
ย 
Connecting Data and Intelligence: The Role of FME in Machine Learning
Connecting Data and Intelligence: The Role of FME in Machine Learning
Safe Software
ย 
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
biswajitbanerjee38
ย 
"Database isolation: how we deal with hundreds of direct connections to the d...
"Database isolation: how we deal with hundreds of direct connections to the d...
Fwdays
ย 
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
ย 
10 Key Challenges for AI within the EU Data Protection Framework.pdf
10 Key Challenges for AI within the EU Data Protection Framework.pdf
Priyanka Aash
ย 
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
ย 
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
ย 
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.
ย 
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
caoyixuan2019
ย 
Securing Account Lifecycles in the Age of Deepfakes.pptx
Securing Account Lifecycles in the Age of Deepfakes.pptx
FIDO Alliance
ย 
OpenPOWER Foundation & Open-Source Core Innovations
OpenPOWER Foundation & Open-Source Core Innovations
IBM
ย 
The Future of Technology: 2025-2125 by Saikat Basu.pdf
The Future of Technology: 2025-2125 by Saikat Basu.pdf
Saikat Basu
ย 
Python Conference Singapore - 19 Jun 2025
Python Conference Singapore - 19 Jun 2025
ninefyi
ย 
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Priyanka Aash
ย 
9-1-1 Addressing: End-to-End Automation Using FME
9-1-1 Addressing: End-to-End Automation Using FME
Safe Software
ย 
Powering Multi-Page Web Applications Using Flow Apps and FME Data Streaming
Powering Multi-Page Web Applications Using Flow Apps and FME Data Streaming
Safe Software
ย 
cnc-processing-centers-centateq-p-110-en.pdf
cnc-processing-centers-centateq-p-110-en.pdf
AmirStern2
ย 
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
ย 
Oh, the Possibilities - Balancing Innovation and Risk with Generative AI.pdf
Oh, the Possibilities - Balancing Innovation and Risk with Generative AI.pdf
Priyanka Aash
ย 
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Safe Software
ย 
Connecting Data and Intelligence: The Role of FME in Machine Learning
Connecting Data and Intelligence: The Role of FME in Machine Learning
Safe Software
ย 
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
biswajitbanerjee38
ย 
"Database isolation: how we deal with hundreds of direct connections to the d...
"Database isolation: how we deal with hundreds of direct connections to the d...
Fwdays
ย 
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
ย 
10 Key Challenges for AI within the EU Data Protection Framework.pdf
10 Key Challenges for AI within the EU Data Protection Framework.pdf
Priyanka Aash
ย 
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
ย 
Ad

java script programming slide 1 from tn state

  • 1. 1. JavaScript Overview What is JavaScript ? ๏ฑ JavaScript started life as LiveScript, but Netscape changed the name, possibly because of the excitement being generated by Java.to JavaScript. JavaScript made its first appearance in Netscape 2.0 in 1995 with a name LiveScript. ๏ฑ JavaScript is a lightweight, interpreted programming language with object-oriented capabilities that allows you to build interactivity into otherwise static HTML pages. ๏ฑ The general-purpose core of the language has been embedded in Netscape, Internet Explorer, and other web browsers
  • 2. JavaScript is: ๏ฑ JavaScript is a lightweight, interpreted programming language ๏ฑ Designed for creating network-centric applications ๏ฑ Complementary to and integrated with Java ๏ฑ Complementary to and integrated with HTML ๏ฑ Open and cross-platform
  • 3. ๏ฑ Client-side JavaScript is the most common form of the language. The script should be included in or referenced by an HTML document for the code to be interpreted by the browser. ๏ฑ It means that a web page need no longer be static HTML, but can include programs that interact with the user, control the browser, and dynamically create HTML content. ๏ฑ The JavaScript code is executed when the user submits the form, and only if all the entries are valid they would be submitted to the Web Server. ๏ฑ JavaScript can be used to trap user-initiated events such as button clicks, link navigation, and other actions that the user explicitly or implicitly initiates. Client-side JavaScript:
  • 4. Advantages of JavaScript: The merits of using JavaScript are: ๏ฑ Less server interaction: You can validate user input before sending the page off to the server. This saves server traffic, which means less load on your server. ๏ฑ Immediate feedback to the visitors: They don't have to wait for a page reload to see if they have forgotten to enter something. ๏ฑ Increased interactivity: You can create interfaces that react when the user hovers over them with a mouse or activates them via the keyboard. ๏ฑ Richer interfaces: You can use JavaScript to include such items as drag-and-drop components and sliders to give a Rich Interface to your site visitors.
  • 5. Limitations with JavaScript: ๏ฑ We can not treat JavaScript as a full fledged programming language. It lacks the following important features: ๏ฑ Client-side JavaScript does not allow the reading or writing of files. This has been kept for security reason. ๏ฑ JavaScript can not be used for Networking applications because there is no such support available. ๏ฑ JavaScript doesn't have any multithreading or multiprocess capabilities.
  • 6. JavaScript Development Tools: ๏ฑ One of JavaScript's strengths is that expensive development tools are not usually required. You can start with a simple text editor such as Notepad. ๏ฑ Since it is an interpreted language inside the context of a web browser, you don't even need to buy a compiler. ๏ฑ To make our life simpler, various vendors have come up with very nice JavaScript editing tools. Few of them are listed here: โ€“ Microsoft FrontPage โ€“ Macromedia Dreamweaver MX โ€“ Macromedia HomeSite 5 โ€“ Yaldex Software Inc., Free JavaScript Editor
  • 7. 2. JavaScript Syntax ๏ฑ A JavaScript consists of JavaScript statements that are placed within the <script>... </script> HTML tags in a web page. ๏ฑ You can place the <script> tag containing your JavaScript anywhere within you web page but it is preferred way to keep it within the <head> tags. ๏ฑ The <script> tag alert the browser program to begin interpreting all the text between these tags as a script. So simple syntax of your JavaScript will be as follows (next slide)
  • 8. <script language="javascript" type="text/javascript"> JavaScript code </script> The script tag takes two important attributes: ๏ฑ language: This attribute specifies what scripting language you are using. Typically, its value will be javascript. Although recent versions of HTML (and XHTML, its successor) have phased out the use of this attribute. ๏ฑ type: This attribute is what is now recommended to indicate the scripting language in use and its value should be set to "text/javascript".
  • 9. Your First JavaScript Script: <html> <body> <script language="javascript" type="text/javascript"> <!-- document.write("Hello World!") //--> </script> </body> </html>
  • 10. ๏ฑ JavaScript ignores spaces, tabs, and newlines that appear in JavaScript programs. ๏ฑ Because you can use spaces, tabs, and newlines freely in your program so you are free to format and indent your programs in a neat and consistent way that makes the code easy to read and understand. Semicolons are Optional: ๏ฑ Simple statements in JavaScript are generally followed by a semicolon character, just as they are in C, C++, and Java. JavaScript, however, allows you to omit this semicolon if your statements are each placed on a separate line. For example, the following code could be written without semicolons Whitespace and Line Breaks:
  • 11. โ€ข JavaScript is a case-sensitive language. This means that language keywords, variables, function names, and any other identifiers must always be typed with a consistent capitalization of letters. โ€ข So identifiers Time, TIme and TIME will have different meanings in JavaScript. โ€ข NOTE: Care should be taken while writing your variable and function names in JavaScript. Case Sensitivity:
  • 12. Comments in JavaScript: โ€ข JavaScript supports both C-style and C++-style comments, Thus: โ€ข Any text between a // and the end of a line is treated as a comment and is ignored by JavaScript. โ€ข Any text between the characters /* and */ is treated as a comment. This may span multiple lines. โ€ข JavaScript also recognizes the HTML comment opening sequence <!--. JavaScript treats this as a single-line comment, just as it does the // comment. โ€ข The HTML comment closing sequence --> is not recognized by JavaScript so it should be written as //-->.
  • 13. Example 1: <script language="javascript" type="text/javascript"> <!-- // This is a comment. It is similar to comments in C+ + /* * This is a multiline comment in JavaScript * It is very similar to comments in C Programming */ //--> </script>
  • 14. Example 2: <html> <head> <script> function displayDate() { document.getElementById("demo").innerHTML=Date(); } </script> </head> <body> <h1>My First JavaScript</h1> <p id="demo">This is a paragraph.</p> <button type="button" onclick="displayDate()">Display Date</button> </body> </html>