SlideShare una empresa de Scribd logo
1 de 32
Java Script
Session No 1

1

Developed By: Saif Ullah Dar

11/22/2013
Session Objectives
1)
2)
3)
4)
5)
6)
7)
8)

9)
10)

What is Java Script?
How a Java Script Work?
What Java Script Can Do?
Browsers Issue.
When Not To Use Java Script?
Java & Java Script.
Usage of Java Script?
How to Use the Java Script?
Types of Scripting.
Your First Program in Java Script.
2

Developed By: Saif Ullah Dar

11/22/2013
What is Java Script ?
•

JavaScript was originally developed by Brendan Eich of Netscape under the
name Mocha, which was later renamed to LiveScript, and finally to JavaScript

•

A lightweight programming language that runs in a Web browser

•

JavaScript is a Client Side Scripting Language.

•

Also known as ECMAScript

•

Interpreted, not compiled.

•

JavaScript Syntax are similar to C and Java Language.

•

JavaScript code is usually embedded directly into HTML pages

•

JavaScript is reasonably platform-independent

3

Developed By: Saif Ullah Dar

11/22/2013
What is code can be inserted directly inthe HTML or
Java Script ?
 JavaScript




can place it in a separate file with the .js extension and
link the web page with the .js file.
Use in web browser for making a website more dynamic.
Supported by Netscape 2+, Internet Explorer 3+, Opera
3+ and most of the other modern web browsers.
Contains variable, array,object,operators and function.

4

Developed By: Saif Ullah Dar

11/22/2013
What is Java Script ?






Browser downloads the code and run it.
Manipulates HTML object also known as DOM, such as
form items, anchors.
Unrelated to Java, despite the name.
It was developed to create a dynamic website.
AJAX has given a brand new look to JavaScript; Now
JavaScript has become more important than ever.

5

Developed By: Saif Ullah Dar

11/22/2013
How a Java Script Work?

6

Developed By: Saif Ullah Dar

11/22/2013
What a Java Script Can Do ?
•

JavaScript gives HTML designers a programming tool

•

JavaScript can put dynamic text into an HTML page

•

JavaScript can react to events

•

JavaScript can read and write HTML elements

•

JavaScript can be used to validate input data

•

JavaScript can be used to detect the visitor's browser

•

JavaScript can be used to create cookies

7

Developed By: Saif Ullah Dar

11/22/2013
Browsers Issue






Different browsers implements different versions of
JavaScript.
Some browsers like Internet Explorer even add their own
functions to enhance the code.
Every JavaScript codes does not work in every browser;
therefore code should be written with the user
demographic in mind.
Newer browsers are adopting standard JavaScript; also
known as “Class A” browsers.

8

Developed By: Saif Ullah Dar

11/22/2013
When Not access other resources. Script
To Use Java
• When you need to
•
•
•

Files Programs
Databases

When you are using sensitive or copyrighted data or algorithms.
• Your JavaScript code is open to the public

9

Developed By: Saif Ullah Dar

11/22/2013
JavaJavaScriptJava Scriptlanguages in both concept and design!
& are two completely different
Java and
1)
2)

JavaScript has some features that resemble features in Java:
1)
2)

JavaScript has qualified names; for example, document.write("Hello World");

3)

JavaScript has Events and event handlers

4)

3)

JavaScript has Objects and primitive data types

Exception handling in JavaScript is almost the same as in Java

JavaScript has some features unlike anything in Java:
1)

Variable names are untyped: the type of a variable depends on the value it is currently holding

2)

Objects and arrays are defined in quite a different way

3)

JavaScript is an interpreted language but java is both interpreted and compiled

10

Developed By: Saif Ullah Dar

11/22/2013
Java & Java Script
Java

JavaScript

Sun Microsystems

Netscape

Much larger and advanced set of
commands.

Much smaller and simpler set of
commands .

Applets distinct from HTML
(accessed from HTML pages).

Code integrated with, and
embedded in, HTML.

Variable data types must be
declared (strong typing).

Variable data types not declared
(loose typing).

Compiled on server before
execution on client.

Interpreted (not compiled) by
client.

11

Developed By: Saif Ullah Dar

11/22/2013
Usage of Java Script that would otherwise
 Used to perform operations





encumber the server, like form validation input.
Can be easily used to interact with HTML elements such
as validate text fields, disable buttons, validate forms, or
change the background color of page.
Create dynamic page
React to events such the user enter name whenever the
page load for 1st time. User can used entered value for
welcome page.

12

Developed By: Saif Ullah Dar

11/22/2013
How To Use Java Script?
 JavaScript can be implemented in three basic styles.






Embed in Body of the document.
Embed in Header of the document.
Load from an external (.js) file.

Embed in Body of the document






This is the easiest way to implement JavaScript.
Embed where needed using <script>…</script>.
This is very poor way of implementation as the functions
cannot be easily reused.
Script is not available for the part of the document which is
above the implantation.
Difficult to manage codes.
13

Developed By: Saif Ullah Dar

11/22/2013
How To Use Java Script?


Embed in Header of the document







Here <script>…</script> is implemented before the <body>
tag.
This ensures that JavaScript functions are available for all the
parts of the documents (DOMs).
Cannot be applied across multiple documents (webpages).
Changes have to be replicated across multiple documents
manually.
Does not make the JavaScript code independent.
More codes.

14

Developed By: Saif Ullah Dar

11/22/2013
How To Useexternal (.js) file
Java Script?
 Load from an









Most efficient way of implementing JavaScript Codes.
Multiple documents can reference single JavaScript files using <script
src=“JSPATH”></script>.
Changes in the script file with automatically reflected to all the
documents that references it.
This enables true separation of header components.
One weakness of this implementation is that a page has to load all
the JavaScript codes regardless it uses it or not. This is helped by
caching; but what if the js file becomes multiple megabytes in size
(this has become true in newer AJAX-enabled website).
One way to overcome this weakness is that breaking up the file into
multiple files and load dynamically only when a function is needed.
AJAX makes this possible.

15

Developed By: Saif Ullah Dar

11/22/2013
Dynamic Load of JavaScript File









With the explosion of AJAX enabled components like JavaScript
trees and grids, JS files tend to become very large – often in multiple
megabytes.
Large files makes the web application slow due to net transfer and
browser processing of large files.
An ideal solution will be only download only the part of the file,
whose function is called.
This can be accomplished by creating multiple files with relevant
piece of the code.
When the function that resides in a file is called; dynamically
download the JS file with that function and load it to the browser –
after it loads to the browser then only execute the function.
All this process should happen within few seconds.

16

Developed By: Saif Ullah Dar

11/22/2013
When to Use JavaScript?







Previously JavaScript was restricted to form validation and
interaction with HTML objects.
Now AJAX (which is basically a JavaScript
implementation) enables us to do more than just
validation.
It is used to fetch data without refreshing the page.
It is used to fetch only the required data and modify only
the part of the webpage.
If you have a high traffic website, JavaScript is a must for
form validation so that it is less burden for the server.

17

Developed By: Saif Ullah Dar

11/22/2013
When NOT to use
JavaScript?






Since all the codes of JavaScript is available to the public; it is
advisable not to put confidential business logic in the JavaScript
code.
As JavaScript runs in client machine you cannot use it to
interact with the files and databases in the server.You would
need an intermediary language like ASP.Net, PHP and CGI to
do the server functions.
If you need some of your data to be indexed by Search
Engines; it is advisable to fetch data in static manner, instead of
using AJAX. Till date Search Engines are not very AJAX friendly.

18

Developed By: Saif Ullah Dar

11/22/2013
Types Of Scripting
Scripting refers to a series of commands that are
interpreted and executed sequentially and immediately on
an occurrence of an event

19

Developed By: Saif Ullah Dar

11/22/2013
Types Of Scripting



Client side Scripting: Refer to a script being executed on the client’s
machine by the browser.
Server side Scripting: Refer to a script being executed on Web
server to generate dynamic HTML pages.

20

Developed By: Saif Ullah Dar

11/22/2013
<SCRIPT> Tag





The <SCRIPT> tag defines a script for an HTML page to make
them interactive
There are two main purpose of the <SCRIPT> tag, which are:
Identifies a given segment of script in the HTML page.
Load an external script file .

21

Developed By: Saif Ullah Dar

11/22/2013
Your First Code:

Ex.1

(Output)
Java Script at the first
sight.

22

Developed By: Saif Ullah Dar

11/22/2013
Your First Code:

Ex.1

html opening
tag

23

Developed By: Saif Ullah Dar

11/22/2013
Your First Code:

Ex.1

html opening tag

Usually Java Scripts
are included within
the head tag, it
also could be
included in the
body tag.

24

Developed By: Saif Ullah Dar

11/22/2013
Your First Code:

Ex.1
html opening tag

One reason
JavaScript is so
popular is that it's
relatively easy to
add JavaScript to a
web page

25

JavaScript
Code block

Developed By: Saif Ullah Dar

Usually Java Scripts
are included within
the head tag, it
also could be
included in the
body tag.

11/22/2013
Your First Code:

Ex.1
<script> tag: Indicate
that the text is part of a
script

26

Developed By: Saif Ullah Dar

11/22/2013
Your First Code:

Ex.1
type attribute:
Specifies the type of file and
the scripting language use.

27

Developed By: Saif Ullah Dar

11/22/2013
Code:

Ex.1

<script> tag:
Indicate that the text
is part of a script

type attribute:
Specifies the type of
file and the scripting
language use.
</script>
End or Close
Tag

28

Developed By: Saif Ullah Dar

11/22/2013
Your First Code:

Ex.1

A Method used
to output a
string onto the
Browser

29

Developed By: Saif Ullah Dar

11/22/2013
Your First Code:

Ex.1

The string, that writeln method
takes and printout on the
browser.
Whatever between the
quotations mark will be printed
as is.

A Method used to output a string
onto the Browser

30

Developed By: Saif Ullah Dar

11/22/2013
Execute Ex.1:

31

Output

Developed By: Saif Ullah Dar

11/22/2013
Thank You
Saif Ullah Dar

32

Developed By: Saif Ullah Dar

11/22/2013

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

Javascript by geetanjali
Javascript by geetanjaliJavascript by geetanjali
Javascript by geetanjali
 
Java script final presentation
Java script final presentationJava script final presentation
Java script final presentation
 
JavaScript guide 2020 Learn JavaScript
JavaScript guide 2020 Learn JavaScriptJavaScript guide 2020 Learn JavaScript
JavaScript guide 2020 Learn JavaScript
 
Java script
Java scriptJava script
Java script
 
Java scripts
Java scriptsJava scripts
Java scripts
 
Basics java scripts
Basics java scriptsBasics java scripts
Basics java scripts
 
Introduction to java script
Introduction to java scriptIntroduction to java script
Introduction to java script
 
A quick guide to Css and java script
A quick guide to Css and  java scriptA quick guide to Css and  java script
A quick guide to Css and java script
 
Java script -23jan2015
Java script -23jan2015Java script -23jan2015
Java script -23jan2015
 
Java script
Java scriptJava script
Java script
 
Java script
Java scriptJava script
Java script
 
Javascript
JavascriptJavascript
Javascript
 
Web programming
Web programmingWeb programming
Web programming
 
Html JavaScript and CSS
Html JavaScript and CSSHtml JavaScript and CSS
Html JavaScript and CSS
 
Java script basics
Java script basicsJava script basics
Java script basics
 
Java Script ppt
Java Script pptJava Script ppt
Java Script ppt
 
Java script
Java scriptJava script
Java script
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
 
Java Script
Java ScriptJava Script
Java Script
 
Java script
Java scriptJava script
Java script
 

Destacado

An Overview of HTML, CSS & Java Script
An Overview of HTML, CSS & Java ScriptAn Overview of HTML, CSS & Java Script
An Overview of HTML, CSS & Java ScriptFahim Abdullah
 
C programming session 07
C programming session 07C programming session 07
C programming session 07Dushmanta Nath
 
C programming session 11
C programming session 11C programming session 11
C programming session 11Dushmanta Nath
 
C programming session 09
C programming session 09C programming session 09
C programming session 09Dushmanta Nath
 
C programming session 03
C programming session 03C programming session 03
C programming session 03Dushmanta Nath
 
C programming session 08
C programming session 08C programming session 08
C programming session 08Dushmanta Nath
 
C programming session 05
C programming session 05C programming session 05
C programming session 05Dushmanta Nath
 
C programming session 04
C programming session 04C programming session 04
C programming session 04Dushmanta Nath
 
C programming session 02
C programming session 02C programming session 02
C programming session 02Dushmanta Nath
 
C programming session 01
C programming session 01C programming session 01
C programming session 01Dushmanta Nath
 
Java Script
Java ScriptJava Script
Java Scriptsiddaram
 
The big bang theory of social recruiting
The big bang theory of social recruitingThe big bang theory of social recruiting
The big bang theory of social recruitingFastCollab
 
Unchallengeable miracle of Holy Quran
Unchallengeable miracle of  Holy QuranUnchallengeable miracle of  Holy Quran
Unchallengeable miracle of Holy Quranyoursincerefriend
 
JAVA SCRIPT
JAVA SCRIPTJAVA SCRIPT
JAVA SCRIPTGo4Guru
 
8. java script
8. java script8. java script
8. java scriptAnusAhmad
 
The Big Bang Theory: Nine Steps To Building Your Meetup Empire
The Big Bang Theory: Nine Steps To Building Your Meetup EmpireThe Big Bang Theory: Nine Steps To Building Your Meetup Empire
The Big Bang Theory: Nine Steps To Building Your Meetup EmpireSeh Hui Leong
 
Introduction to JavaScript: Week Two
Introduction to JavaScript: Week TwoIntroduction to JavaScript: Week Two
Introduction to JavaScript: Week TwoEvent Handler
 

Destacado (20)

An Overview of HTML, CSS & Java Script
An Overview of HTML, CSS & Java ScriptAn Overview of HTML, CSS & Java Script
An Overview of HTML, CSS & Java Script
 
Session No1
Session No1 Session No1
Session No1
 
Session no 2
Session no 2Session no 2
Session no 2
 
C programming session 07
C programming session 07C programming session 07
C programming session 07
 
Session no 4
Session no 4Session no 4
Session no 4
 
C programming session 11
C programming session 11C programming session 11
C programming session 11
 
C programming session 09
C programming session 09C programming session 09
C programming session 09
 
C programming session 03
C programming session 03C programming session 03
C programming session 03
 
C programming session 08
C programming session 08C programming session 08
C programming session 08
 
C programming session 05
C programming session 05C programming session 05
C programming session 05
 
C programming session 04
C programming session 04C programming session 04
C programming session 04
 
C programming session 02
C programming session 02C programming session 02
C programming session 02
 
C programming session 01
C programming session 01C programming session 01
C programming session 01
 
Java Script
Java ScriptJava Script
Java Script
 
The big bang theory of social recruiting
The big bang theory of social recruitingThe big bang theory of social recruiting
The big bang theory of social recruiting
 
Unchallengeable miracle of Holy Quran
Unchallengeable miracle of  Holy QuranUnchallengeable miracle of  Holy Quran
Unchallengeable miracle of Holy Quran
 
JAVA SCRIPT
JAVA SCRIPTJAVA SCRIPT
JAVA SCRIPT
 
8. java script
8. java script8. java script
8. java script
 
The Big Bang Theory: Nine Steps To Building Your Meetup Empire
The Big Bang Theory: Nine Steps To Building Your Meetup EmpireThe Big Bang Theory: Nine Steps To Building Your Meetup Empire
The Big Bang Theory: Nine Steps To Building Your Meetup Empire
 
Introduction to JavaScript: Week Two
Introduction to JavaScript: Week TwoIntroduction to JavaScript: Week Two
Introduction to JavaScript: Week Two
 

Similar a Java script Session No 1

INTRODUCTION.docx
INTRODUCTION.docxINTRODUCTION.docx
INTRODUCTION.docxKaiSane1
 
Front End Development | Introduction
Front End Development | IntroductionFront End Development | Introduction
Front End Development | IntroductionJohnTaieb
 
Java script Basic
Java script BasicJava script Basic
Java script BasicJaya Kumari
 
Web programming UNIT II by Bhavsingh Maloth
Web programming UNIT II by Bhavsingh MalothWeb programming UNIT II by Bhavsingh Maloth
Web programming UNIT II by Bhavsingh MalothBhavsingh Maloth
 
WEB PROGRAMMING UNIT II BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT II BY BHAVSINGH MALOTHWEB PROGRAMMING UNIT II BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT II BY BHAVSINGH MALOTHBhavsingh Maloth
 
5 Powerful Backend Frameworks for Web App Development in 2022
5 Powerful Backend Frameworks for Web App Development in 20225 Powerful Backend Frameworks for Web App Development in 2022
5 Powerful Backend Frameworks for Web App Development in 202275waytechnologies
 
Making Of PHP Based Web Application
Making Of PHP Based Web ApplicationMaking Of PHP Based Web Application
Making Of PHP Based Web ApplicationSachin Walvekar
 
Java script by Act Academy
Java script by Act AcademyJava script by Act Academy
Java script by Act Academyactanimation
 
Unit 4 Java script.pptx
Unit 4 Java script.pptxUnit 4 Java script.pptx
Unit 4 Java script.pptxGangesh8
 
Introduction to Jquery
Introduction to JqueryIntroduction to Jquery
Introduction to JqueryGurpreet singh
 
Web II - 01 - Introduction to server-side development
Web II - 01 - Introduction to server-side developmentWeb II - 01 - Introduction to server-side development
Web II - 01 - Introduction to server-side developmentRandy Connolly
 
9 Best JavaScript Frameworks To Choose
9 Best JavaScript Frameworks To Choose9 Best JavaScript Frameworks To Choose
9 Best JavaScript Frameworks To ChooseAlbiorix Technology
 
Java Script - A New Look
Java Script - A New LookJava Script - A New Look
Java Script - A New Lookrumsan
 

Similar a Java script Session No 1 (20)

INTRODUCTION.docx
INTRODUCTION.docxINTRODUCTION.docx
INTRODUCTION.docx
 
Javascript 01 (js)
Javascript 01 (js)Javascript 01 (js)
Javascript 01 (js)
 
wt mod3.pdf
wt mod3.pdfwt mod3.pdf
wt mod3.pdf
 
Front End Development | Introduction
Front End Development | IntroductionFront End Development | Introduction
Front End Development | Introduction
 
Java script Basic
Java script BasicJava script Basic
Java script Basic
 
Web programming UNIT II by Bhavsingh Maloth
Web programming UNIT II by Bhavsingh MalothWeb programming UNIT II by Bhavsingh Maloth
Web programming UNIT II by Bhavsingh Maloth
 
WEB PROGRAMMING UNIT II BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT II BY BHAVSINGH MALOTHWEB PROGRAMMING UNIT II BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT II BY BHAVSINGH MALOTH
 
5 Powerful Backend Frameworks for Web App Development in 2022
5 Powerful Backend Frameworks for Web App Development in 20225 Powerful Backend Frameworks for Web App Development in 2022
5 Powerful Backend Frameworks for Web App Development in 2022
 
Making Of PHP Based Web Application
Making Of PHP Based Web ApplicationMaking Of PHP Based Web Application
Making Of PHP Based Web Application
 
Javascript & Jquery
Javascript & JqueryJavascript & Jquery
Javascript & Jquery
 
Java script by Act Academy
Java script by Act AcademyJava script by Act Academy
Java script by Act Academy
 
Web summit.pptx
Web summit.pptxWeb summit.pptx
Web summit.pptx
 
Reactjs Basics
Reactjs BasicsReactjs Basics
Reactjs Basics
 
Unit 4 Java script.pptx
Unit 4 Java script.pptxUnit 4 Java script.pptx
Unit 4 Java script.pptx
 
Introduction to Jquery
Introduction to JqueryIntroduction to Jquery
Introduction to Jquery
 
Javascript frameworks
Javascript frameworksJavascript frameworks
Javascript frameworks
 
Web II - 01 - Introduction to server-side development
Web II - 01 - Introduction to server-side developmentWeb II - 01 - Introduction to server-side development
Web II - 01 - Introduction to server-side development
 
9 Best JavaScript Frameworks To Choose
9 Best JavaScript Frameworks To Choose9 Best JavaScript Frameworks To Choose
9 Best JavaScript Frameworks To Choose
 
Java Script - A New Look
Java Script - A New LookJava Script - A New Look
Java Script - A New Look
 
Node.js
Node.jsNode.js
Node.js
 

Más de Saif Ullah Dar

Más de Saif Ullah Dar (7)

Session no 3
Session no 3Session no 3
Session no 3
 
Session no 1
Session no 1Session no 1
Session no 1
 
Session no 1 html
Session no 1 htmlSession no 1 html
Session no 1 html
 
Session no 3 bzu
Session no 3 bzuSession no 3 bzu
Session no 3 bzu
 
Session no 2 For BZU
Session no 2 For BZUSession no 2 For BZU
Session no 2 For BZU
 
Java script session 4
Java script session 4Java script session 4
Java script session 4
 
Xml Session No 1
Xml Session No 1Xml Session No 1
Xml Session No 1
 

Último

Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterMateoGardella
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfSanaAli374401
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 

Último (20)

Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 

Java script Session No 1

  • 1. Java Script Session No 1 1 Developed By: Saif Ullah Dar 11/22/2013
  • 2. Session Objectives 1) 2) 3) 4) 5) 6) 7) 8) 9) 10) What is Java Script? How a Java Script Work? What Java Script Can Do? Browsers Issue. When Not To Use Java Script? Java & Java Script. Usage of Java Script? How to Use the Java Script? Types of Scripting. Your First Program in Java Script. 2 Developed By: Saif Ullah Dar 11/22/2013
  • 3. What is Java Script ? • JavaScript was originally developed by Brendan Eich of Netscape under the name Mocha, which was later renamed to LiveScript, and finally to JavaScript • A lightweight programming language that runs in a Web browser • JavaScript is a Client Side Scripting Language. • Also known as ECMAScript • Interpreted, not compiled. • JavaScript Syntax are similar to C and Java Language. • JavaScript code is usually embedded directly into HTML pages • JavaScript is reasonably platform-independent 3 Developed By: Saif Ullah Dar 11/22/2013
  • 4. What is code can be inserted directly inthe HTML or Java Script ?  JavaScript    can place it in a separate file with the .js extension and link the web page with the .js file. Use in web browser for making a website more dynamic. Supported by Netscape 2+, Internet Explorer 3+, Opera 3+ and most of the other modern web browsers. Contains variable, array,object,operators and function. 4 Developed By: Saif Ullah Dar 11/22/2013
  • 5. What is Java Script ?      Browser downloads the code and run it. Manipulates HTML object also known as DOM, such as form items, anchors. Unrelated to Java, despite the name. It was developed to create a dynamic website. AJAX has given a brand new look to JavaScript; Now JavaScript has become more important than ever. 5 Developed By: Saif Ullah Dar 11/22/2013
  • 6. How a Java Script Work? 6 Developed By: Saif Ullah Dar 11/22/2013
  • 7. What a Java Script Can Do ? • JavaScript gives HTML designers a programming tool • JavaScript can put dynamic text into an HTML page • JavaScript can react to events • JavaScript can read and write HTML elements • JavaScript can be used to validate input data • JavaScript can be used to detect the visitor's browser • JavaScript can be used to create cookies 7 Developed By: Saif Ullah Dar 11/22/2013
  • 8. Browsers Issue     Different browsers implements different versions of JavaScript. Some browsers like Internet Explorer even add their own functions to enhance the code. Every JavaScript codes does not work in every browser; therefore code should be written with the user demographic in mind. Newer browsers are adopting standard JavaScript; also known as “Class A” browsers. 8 Developed By: Saif Ullah Dar 11/22/2013
  • 9. When Not access other resources. Script To Use Java • When you need to • • • Files Programs Databases When you are using sensitive or copyrighted data or algorithms. • Your JavaScript code is open to the public 9 Developed By: Saif Ullah Dar 11/22/2013
  • 10. JavaJavaScriptJava Scriptlanguages in both concept and design! & are two completely different Java and 1) 2) JavaScript has some features that resemble features in Java: 1) 2) JavaScript has qualified names; for example, document.write("Hello World"); 3) JavaScript has Events and event handlers 4) 3) JavaScript has Objects and primitive data types Exception handling in JavaScript is almost the same as in Java JavaScript has some features unlike anything in Java: 1) Variable names are untyped: the type of a variable depends on the value it is currently holding 2) Objects and arrays are defined in quite a different way 3) JavaScript is an interpreted language but java is both interpreted and compiled 10 Developed By: Saif Ullah Dar 11/22/2013
  • 11. Java & Java Script Java JavaScript Sun Microsystems Netscape Much larger and advanced set of commands. Much smaller and simpler set of commands . Applets distinct from HTML (accessed from HTML pages). Code integrated with, and embedded in, HTML. Variable data types must be declared (strong typing). Variable data types not declared (loose typing). Compiled on server before execution on client. Interpreted (not compiled) by client. 11 Developed By: Saif Ullah Dar 11/22/2013
  • 12. Usage of Java Script that would otherwise  Used to perform operations    encumber the server, like form validation input. Can be easily used to interact with HTML elements such as validate text fields, disable buttons, validate forms, or change the background color of page. Create dynamic page React to events such the user enter name whenever the page load for 1st time. User can used entered value for welcome page. 12 Developed By: Saif Ullah Dar 11/22/2013
  • 13. How To Use Java Script?  JavaScript can be implemented in three basic styles.     Embed in Body of the document. Embed in Header of the document. Load from an external (.js) file. Embed in Body of the document      This is the easiest way to implement JavaScript. Embed where needed using <script>…</script>. This is very poor way of implementation as the functions cannot be easily reused. Script is not available for the part of the document which is above the implantation. Difficult to manage codes. 13 Developed By: Saif Ullah Dar 11/22/2013
  • 14. How To Use Java Script?  Embed in Header of the document       Here <script>…</script> is implemented before the <body> tag. This ensures that JavaScript functions are available for all the parts of the documents (DOMs). Cannot be applied across multiple documents (webpages). Changes have to be replicated across multiple documents manually. Does not make the JavaScript code independent. More codes. 14 Developed By: Saif Ullah Dar 11/22/2013
  • 15. How To Useexternal (.js) file Java Script?  Load from an       Most efficient way of implementing JavaScript Codes. Multiple documents can reference single JavaScript files using <script src=“JSPATH”></script>. Changes in the script file with automatically reflected to all the documents that references it. This enables true separation of header components. One weakness of this implementation is that a page has to load all the JavaScript codes regardless it uses it or not. This is helped by caching; but what if the js file becomes multiple megabytes in size (this has become true in newer AJAX-enabled website). One way to overcome this weakness is that breaking up the file into multiple files and load dynamically only when a function is needed. AJAX makes this possible. 15 Developed By: Saif Ullah Dar 11/22/2013
  • 16. Dynamic Load of JavaScript File       With the explosion of AJAX enabled components like JavaScript trees and grids, JS files tend to become very large – often in multiple megabytes. Large files makes the web application slow due to net transfer and browser processing of large files. An ideal solution will be only download only the part of the file, whose function is called. This can be accomplished by creating multiple files with relevant piece of the code. When the function that resides in a file is called; dynamically download the JS file with that function and load it to the browser – after it loads to the browser then only execute the function. All this process should happen within few seconds. 16 Developed By: Saif Ullah Dar 11/22/2013
  • 17. When to Use JavaScript?      Previously JavaScript was restricted to form validation and interaction with HTML objects. Now AJAX (which is basically a JavaScript implementation) enables us to do more than just validation. It is used to fetch data without refreshing the page. It is used to fetch only the required data and modify only the part of the webpage. If you have a high traffic website, JavaScript is a must for form validation so that it is less burden for the server. 17 Developed By: Saif Ullah Dar 11/22/2013
  • 18. When NOT to use JavaScript?    Since all the codes of JavaScript is available to the public; it is advisable not to put confidential business logic in the JavaScript code. As JavaScript runs in client machine you cannot use it to interact with the files and databases in the server.You would need an intermediary language like ASP.Net, PHP and CGI to do the server functions. If you need some of your data to be indexed by Search Engines; it is advisable to fetch data in static manner, instead of using AJAX. Till date Search Engines are not very AJAX friendly. 18 Developed By: Saif Ullah Dar 11/22/2013
  • 19. Types Of Scripting Scripting refers to a series of commands that are interpreted and executed sequentially and immediately on an occurrence of an event 19 Developed By: Saif Ullah Dar 11/22/2013
  • 20. Types Of Scripting   Client side Scripting: Refer to a script being executed on the client’s machine by the browser. Server side Scripting: Refer to a script being executed on Web server to generate dynamic HTML pages. 20 Developed By: Saif Ullah Dar 11/22/2013
  • 21. <SCRIPT> Tag     The <SCRIPT> tag defines a script for an HTML page to make them interactive There are two main purpose of the <SCRIPT> tag, which are: Identifies a given segment of script in the HTML page. Load an external script file . 21 Developed By: Saif Ullah Dar 11/22/2013
  • 22. Your First Code: Ex.1 (Output) Java Script at the first sight. 22 Developed By: Saif Ullah Dar 11/22/2013
  • 23. Your First Code: Ex.1 html opening tag 23 Developed By: Saif Ullah Dar 11/22/2013
  • 24. Your First Code: Ex.1 html opening tag Usually Java Scripts are included within the head tag, it also could be included in the body tag. 24 Developed By: Saif Ullah Dar 11/22/2013
  • 25. Your First Code: Ex.1 html opening tag One reason JavaScript is so popular is that it's relatively easy to add JavaScript to a web page 25 JavaScript Code block Developed By: Saif Ullah Dar Usually Java Scripts are included within the head tag, it also could be included in the body tag. 11/22/2013
  • 26. Your First Code: Ex.1 <script> tag: Indicate that the text is part of a script 26 Developed By: Saif Ullah Dar 11/22/2013
  • 27. Your First Code: Ex.1 type attribute: Specifies the type of file and the scripting language use. 27 Developed By: Saif Ullah Dar 11/22/2013
  • 28. Code: Ex.1 <script> tag: Indicate that the text is part of a script type attribute: Specifies the type of file and the scripting language use. </script> End or Close Tag 28 Developed By: Saif Ullah Dar 11/22/2013
  • 29. Your First Code: Ex.1 A Method used to output a string onto the Browser 29 Developed By: Saif Ullah Dar 11/22/2013
  • 30. Your First Code: Ex.1 The string, that writeln method takes and printout on the browser. Whatever between the quotations mark will be printed as is. A Method used to output a string onto the Browser 30 Developed By: Saif Ullah Dar 11/22/2013
  • 31. Execute Ex.1: 31 Output Developed By: Saif Ullah Dar 11/22/2013
  • 32. Thank You Saif Ullah Dar 32 Developed By: Saif Ullah Dar 11/22/2013