SlideShare a Scribd company logo
Introduction to
JavaScript
Web Programming
Programming for the World Wide Web involves
Server-side programming
Client-side (browser-side) programming
What is JavaScript?
JavaScript is used to program the behaviour of web pages
(performing dynamic tasks).
Javascript are scripts (code) that is executed on the client’s browser
instead of the web-server (Client-side scripts).
Why we need client side programming
The user’s actions will result in an immediate response because they
don't require a trip to the server.
 Allows the creation of faster and more responsive web applications.
 Make web pages more interactive
Fewer resources are used and needed on the web-server.

Recommended for you

Js ppt
Js pptJs ppt
Js ppt

This document provides an overview of JavaScript, including: - JavaScript is a client-side scripting language designed for web pages that enhances HTML with dynamic and interactive features. - It was initially developed by Netscape as LiveScript but was renamed JavaScript and standardized along with Java. - JavaScript can react to events, validate data, detect the browser, create cookies, and read/write HTML elements. - Key JavaScript concepts covered include objects, properties, methods, functions, values, variables, and the HTML DOM for finding and manipulating elements.

jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginners

Slides for presentation C002 | jQuery for beginners in Sumofyou Technologies

javascriptjquery
Css Ppt
Css PptCss Ppt
Css Ppt

This document provides an overview of various CSS topics including comments, colors, text formatting, positioning, and cross-browser compatibility. It explains concepts like using hexadecimal color codes, text properties like alignment and decoration, positioning elements with static, relative, absolute and fixed positioning, and strategies for aligning elements and dealing with browser inconsistencies.

Characteristics of JavaScript
Object-based
• Doesn't support all the features of OOPs like Polymorphism and Inheritance
Event-Driven
• Much of the JavaScript code you write will be in response to events generated by the
user or the system.
Browser-Dependent
• JavaScript depends on the Web browser to support it. If the browser does not support
it, your code will be ignored. Even worse, the JavaScript code itself may be displayed
as text on your page.
Characteristics of JavaScript (cont.)
Interpreted language
• JavaScript is interpreted at runtime by the browser before it is executed.
JavaScript is not compiled into an actual program like an .EXE file but
remains part of the HTML document to which it is attached.
Dynamic
• You can declare variables of a specific type, but you do not need to
Case sensitive
What Javascript can do?
Javascript can change HTML Content
Javascript can change HTML Attributes
Javascript can change HTML Styles (CSS)
Javascript can Validate Data
Javascript can Make Calculations
Embedding JavaScript in HTML
1. Anywhere in the html file between <script></script> tags.
2. As the value of the event handler attributes.

Recommended for you

Javascript
JavascriptJavascript
Javascript

This document is a presentation about JavaScript that covers what JavaScript is, where it came from, and what it can do. It introduces JavaScript as a scripting language that is easy to use and learn and runs in web browsers. The presentation explains that JavaScript is unrelated to Java but borrows some naming conventions. It provides overviews of JavaScript basics like variables, operators, and functions, as well as more advanced topics like objects, events, and DOM manipulation.

htmldommomenumdesignlab
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...

( ** Full Stack Web Development Training: https://www.edureka.co/masters-program/full-stack-developer-training ** ) This Edureka tutorial on JavaScript explains all the fundamentals of JavaScript with examples. It also explains various features and applications of JavaScript. Following are the topics included in this tutorial: 1. What Is JavaScript? 2. Why Use JavaScript 3. JavaScript Fundamentals - Data Types - Variables - Constants - Loops - Conditional Statements - Functions

javascriptjavascript tutorialjavascript tutorial for beginners
JavaScript Tutorial
JavaScript  TutorialJavaScript  Tutorial
JavaScript Tutorial

JavaScript is a scripting language used to make web pages interactive. It was created in 1995 and standardized as ECMAScript. JavaScript can access and modify the content, structure, and style of documents. It is used to handle events, perform animations, and interact with forms on web pages. Common uses of JavaScript include form validation, navigation menus, lightboxes, and sliders on websites.

Embedding JavaScript in HTML
3. In an external file and refer to it using the SRC attribute.
Note:
Keeping all code in one place, is always a good habit.
JavaScript Display Possibilities
JavaScript can "display" data in different ways:
Writing into an alert box, using window.alert(), window.prompt(),
window.confirm().
Writing into an HTML element, using innerHTML.
Alerts
JavaScript written
inside HTMLAn Event
Prompts and Confirm
Prompts :The return is the data the user entered
The confirm returns true and false

Recommended for you

CSS Basics
CSS BasicsCSS Basics
CSS Basics

Presentation to WordPress Memphis meetup group on December 2, 2010, CSS Basics. By designer Irina McGuire. http://www.irinamcguire.com

wordpresscsswordpress memphis
JavaScript Programming
JavaScript ProgrammingJavaScript Programming
JavaScript Programming

The document provides an overview of JavaScript programming. It discusses the history and components of JavaScript, including ECMAScript, the DOM, and BOM. It also covers JavaScript basics like syntax, data types, operators, and functions. Finally, it introduces object-oriented concepts in JavaScript like prototype-based programming and early vs. late binding.

oopjavascript
Functions in javascript
Functions in javascriptFunctions in javascript
Functions in javascript

The document provides information about a mentoring program run by Baabtra-Mentoring Partner including a trainee's typing speed progress over 3 weeks, jobs applied to with current statuses, an introduction to functions in Javascript covering definitions, advantages, examples, and local and global variables. Contact details for Baabtra are also provided at the end.

baabtra mentoring partner
Events
Event handlers are created as attributes added to the HTML tags in
which the event is triggered.
An Event handler adopts the event name and appends the word
“on” in front of it.
Thus the “click” event becomes the onclick event handler.
Mouse Events
Event handler Description
onmousedown when pressing any of the mouse buttons.
onmousemove when the user moves the mouse pointer within an
element.
onmouseout when moving the mouse pointer out of an element.
onmouseup when the user releases any mouse button pressed
onmouseover when the user moves the mouse pointer over an
element.
onclick when clicking the left mouse button on an element.
ondblclick when Double-clicking the left mouse button on an
element.
ondragstart When the user has begun to select an element
Keyboard Events
Event handler Description
onkeydown When User holds down a key
onkeypress When User presses a key
onkeyup When User releases the pressed a key
JavaScript Functions
A JavaScript function is a block of code designed to perform a
particular task.
A function is executed when "something" invokes it (calls it).
 When an event occurs (when a user clicks a button)
 When it is invoked (called) from JavaScript code
 Automatically (self invoked)

Recommended for you

JavaScript - An Introduction
JavaScript - An IntroductionJavaScript - An Introduction
JavaScript - An Introduction

JavaScript - An Introduction is a beginner's guide to JavaScript. It starts with very basic level and goes to intermediate level. You'll be introduced with every language constructs, Event handling, Form handling and AJAX which is supported by JavaScript with XMLHttpRequest object. This XHR object is discussed in enough detail so that you can understand how the underlying AJAX functionality works in jQuery. At the end it discusses advance concepts and library build on/around JavaScript.

introductionjavascriptevents
3. Java Script
3. Java Script3. Java Script
3. Java Script

The document provides an introduction to JavaScript, including its history and uses. It discusses how JavaScript is an interpreted programming language used for client-side scripting of web pages to make them dynamic and interactive. The document outlines key JavaScript concepts like variables, functions, operators, and conditional statements. It provides examples of how to write JavaScript programs and embed them in HTML files using the <script> tag.

jsjavascriptweb
Javascript essentials
Javascript essentialsJavascript essentials
Javascript essentials

Things you should know about Javascript ES5. A programming language that enables you to create dynamically updating content, control multimedia, animate images, and pretty much everything else

javascriptes5web
Function Invocation types
When an event occurs (e.g. when a user clicks a button)
Function Invocation types(cont.)
 When it is invoked (called) from JavaScript code
Function Invocation types (cont.)
 Automatically (self invoked)
Function Return
When JavaScript reaches a return statement, the function will stop executing
and returns some value to the invoker.
If the function was invoked from a statement, JavaScript will "return" to
execute the code after the invoking statement.

Recommended for you

Javascript
JavascriptJavascript
Javascript

How Javascript Works? behind the scenes It explains how javascript is parsed in the browsers, what happens while parsing javascript in a browser

javascriptbehindthescenesworks
HTML (Web) basics for a beginner
HTML (Web) basics for a beginnerHTML (Web) basics for a beginner
HTML (Web) basics for a beginner

HTML is the backbone of Internet. Learn the basics of HTML, you can create your own website. If you have any doubt contact me for more details. WhatsApp:8008877940

htmlhtml basicsbasics of html
cascading style sheet ppt
cascading style sheet pptcascading style sheet ppt
cascading style sheet ppt

CSS (Cascading Style Sheets) is used to define styles for displaying HTML elements. CSS has different levels that add new features denoted as CSS1, CSS2, CSS3. CSS saves work by defining styles that can be applied across multiple web pages through external style sheets or internal/inline styles. CSS style rules contain selectors and declarations, with properties and values. CSS comments, id and class selectors, and multiple style sheets are also discussed in the document.

JavaScript Built-in functions
Name Example
parseInt()
parseInt("3") //returns 3
parseInt(“3a”) //returns 3
parseInt(“a3”) //returns NaN
parseInt("110", 2)// returns 6
parseInt("0xD9", 16)// returns 217
parseFloat()
parseFloat("3.55") //returns 3.55
parseFloat(“3.55a”) //returns 3.55
parseFloat(“a3.55”) //returns NaN
Number() myVar = new Boolean("true")
document.write(Number(myVar)) // returns 1
String()
myVar = new Boolean(0)
document.write(String(myVar)) // returns false
JavaScript Built-in functions
Name Description Example
isFinite(num)
(used to test number)
returns true if the
number is finite, else
false
document.write(isFinite(2.2345))
//returns true
document.write(isFinite(“Hello”))
//returns false
isNaN(val)
(used to test value)
validate the argument
for a number and
returns true if the
given value is not a
number else returns
false.
document.write(isNaN(0/0))
//returns true
document.write(isNaN("348"))
//returns false
eval(expression)
evaluates an
expression and
returns the result.
f=999; w=777;
document.write(eval(f + w));
// returns 1776
JavaScript Built-in functions
Name Description Example
escape(string)
method converts the special
characters like space, colon
etc. of the given string in to
escape sequences.
escape("test val");
//test%20val
unescape(string)
function replaces the escape
sequences with original
values.
e.g. %20 is the escape
sequence for space " ".
unescape("test%20val");
//test val
JavaScript Primitive Value types
Value Example
Number Any numeric value (e.g., 3, 5.3, or 45e8)
String
Any string of alphanumeric characters
(e.g., "Hello, World!", "555-1212" or
"KA12V2B334")
Boolean True or False values only

Recommended for you

Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)

This document provides an introduction to Cascading Style Sheets (CSS) including definitions, why CSS is used, the cascade, inheritance, using style sheets, CSS syntax, selectors, the box model, CSS and the semantic web, browser acceptance, fonts, units, colors, layouts, text formatting, backgrounds, lists, shorthand properties, accessibility, and resources for further information.

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

HTML is a markup language used to define the structure and layout of web pages. It uses tags like <h1> and <p> to mark headings and paragraphs. CSS is used to style and lay out HTML elements, using selectors, declarations, and properties to change things like colors and positioning. JavaScript can be added to HTML pages with <script> tags and is used to add interactive elements and dynamic behavior by manipulating HTML and responding to user input. It has data types like strings and numbers and control structures like if/else statements.

html learninghtmlcss learning
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript

JavaScript is lingua franca of the Web. It's pervasive and since 1999 a standard ( ECMAScript 262). Yes, there are other technologies you can use: Flash, Java Applets, Dart, but none of these have the overwhelming support and community that JavaScript does. Over the years it has been maligned as a poorly designed language but I will argue that it has just been misunderstood. This talk will focus on the fundamentals of the language and its integration with the browser, the DOM and server communication via JSON and Ajax. In the talk Bryan will present: * Language fundamentals * Object-Oriented programming * Functional programming * DOM APIs * Event model * Odds and ends

javascript functional object-oriented
JavaScript Special Values
Value Example
Null
Eg: var x = null;
A special keyword for the null value
(no value or empty variable)
** x has the type ‘object’
Undefined
Eg: var x;
A special keyword means that a value
hasn't even been assigned yet.
** x has the type ‘undefined’
JavaScript Variables
Variables are containers that hold values.
Variables are untyped
The initial value for any variable is undefined.
var num; //num = undefined
 While it is not technically necessary, variable declarations should begin
with the keyword var.
JavaScript Variables Scope
 Global Scope
 Local Scope
<script>
x=1
var y=2
function MyFunction()
{
var z
z=3
// the rest of the code
}
</script>
Global scope
Local scope
Controlling Program Flow
Program flow is normally linear
Control Statements can change the program flow
1. Conditional Statements
a. if ….else
b. switch/case
2. Loop Statements
a. for
b. for..in loops through the properties of an object
c. while
d. do…while

Recommended for you

Understanding the Computer System
Understanding the Computer SystemUnderstanding the Computer System
Understanding the Computer System

The document discusses the major hardware components of a computer system, including the system unit, motherboard, CPU, memory, expansion bus, power supply, hard disk drive, optical drive, ports, and input/output devices. It describes the functions of these core internal parts and external components like monitors, printers, keyboards, and mice that allow interaction with the computer.

CSS Dasar #2 : Anatomy CSS
CSS Dasar #2 : Anatomy CSSCSS Dasar #2 : Anatomy CSS
CSS Dasar #2 : Anatomy CSS

Dokumen tersebut membahas tentang anatomi CSS yang menerangkan tentang selector, property, dan value yang digunakan untuk mengatur tampilan elemen HTML melalui deklarasi CSS seperti mengubah warna teks, font, ukuran teks dan lainnya.

websitedasardesign
CSS Layouting #5 : Position
CSS Layouting #5 : PositionCSS Layouting #5 : Position
CSS Layouting #5 : Position

Position adalah properti CSS yang dapat membuat kita melakukan tata letak dari elemen HTML sesuai dengan keinginan kita. ada 4 value yang bisa kita gunakan pada properti position : 1. static 2. relative 3. absolute 4. fixed

fixedprogrammingunpas
HTML DOM (Document Object Model)
The HTML DOM is a standard for how to get, change, add, or delete
HTML elements.
Finding HTML Elements
Method Description
document.getElementById() Find an element by element id
document.getElementsByTagName() Find elements by tag name
document.getElementsByClassName() Find elements by class name
Changing HTML elements
Method Description
element.innerHTML=
Change the inner HTML of an
element
element.attribute=
Change the attribute of an HTML
element
element.setAttribute(attribute,value)
Change the attribute of an HTML
element
element.style.property= Change the style of an HTML element
Adding and deleting elements
Method Description
document.createElement(...) Create an HTML element
document.removeChild(...) Remove an HTML element
document.appendChild(...) Add an HTML element
document.replaceChild(...) Replace an HTML element
document.write(text) Write into the HTML output stream

Recommended for you

Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker

Docker is an open platform for developing, shipping, and running applications. It allows separating applications from infrastructure and treating infrastructure like code. Docker provides lightweight containers that package code and dependencies together. The Docker architecture includes images that act as templates for containers, a client-server model with a daemon, and registries for storing images. Key components that enable containers are namespaces, cgroups, and capabilities. The Docker ecosystem includes services like Docker Hub, Docker Swarm for clustering, and Docker Compose for orchestration.

dockerdocker-cairomeetup
HTML Dasar : #9 Tabel
HTML Dasar : #9 TabelHTML Dasar : #9 Tabel
HTML Dasar : #9 Tabel

Slide pendukung untuk mata kuliah Pemrograman Web 1 di Jurusan Teknik Informatika Universitas Pasundan Bandung. Digunakan juga sebagai pendukung untuk video di channel youtube "WebProgrammingUNPAS" https://www.youtube.com/channel/UCkXmLjEr95LVtGuIm3l2dPg

universitas pasundanindonesiabandung
CSS Layouting #2 : Dimensi & Overflow
CSS Layouting #2 : Dimensi & OverflowCSS Layouting #2 : Dimensi & Overflow
CSS Layouting #2 : Dimensi & Overflow

Ada 2 property pada CSS yang digunakan untuk mengatur Dimensi pada elemen HTML kita, property-nya yaitu width dan height. Pada video ini, kita akan bahas bagaimana cara menggunakan property tersebut, dan juga unit / satuan apa saja yang dapat kita gunakan untuk mengatur width dan height-nya. Di video ini juga akan dibahas mengenai overflow, yaitu property CSS yang digunakan untuk mengatur perilaku sebuah elemen, ketika isi / konten nya melebihi tempat / parent nya. slide bantuan untuk video youtube: https://youtu.be/VkUSH3SIH0g

pemrogramanprogrammingwebsite
The addEventListener() method
Adds the function to an event attribute (onclick in this example) of
the selected element
The addEventListener() method
Another way is to add only the name of the function and define it
separately in your scripts
HTML Forms and JavaScript
HTML <form> elements receive input
JavaScript is very good at processing user input in the web browser
Forms and form elements have unique names
Each unique element can be identified
Uses JavaScript Document Object Model (DOM)
Naming Form Elements in HTML

Recommended for you

HTML Dasar : #6 List
HTML Dasar : #6 ListHTML Dasar : #6 List
HTML Dasar : #6 List

Slide pendukung untuk mata kuliah Pemrograman Web 1 di Jurusan Teknik Informatika Universitas Pasundan Bandung. Digunakan juga sebagai pendukung untuk video di channel youtube "WebProgrammingUNPAS" https://www.youtube.com/channel/UCkXmLjEr95LVtGuIm3l2dPg

bandunghtmldasar
CSS Layouting #1 : Display
CSS Layouting #1 : DisplayCSS Layouting #1 : Display
CSS Layouting #1 : Display

Setiap elemen HTML yang kita buat memiliki property css display, pada slide ini akan dibahas bagaimana masing-masing perilaku dari value pada properti display tersebut. value yang dapat digunakan adalah : - inline - inline-block - block - none slide bantuan untuk video youtube: https://youtu.be/VPaIdiPvWQM

unpascssdesain
CSS Box Model
CSS Box ModelCSS Box Model
CSS Box Model

The document discusses CSS box model concepts including boxes, borders, margins, padding, and dimensions. It provides examples of how to control the width, height, padding, margins and borders of boxes using CSS properties. It also covers the difference between block and inline boxes and how to set them as block or inline using the display property.

Using Form data
To access the values of the form element use the following syntax:
document.formname.elementname.value
Example
document.addressform.yourname.value
document.addressform.phone.value
document.addressform.email.value
Example
Personalising an alert box
Assignment
Complete this course
https://www.edx.org/course/javascript-intro
Due date: 14-10-2017

Recommended for you

CSS Dasar #4 : Font Styling
CSS Dasar #4 : Font StylingCSS Dasar #4 : Font Styling
CSS Dasar #4 : Font Styling

Font merupakan elemen pada halaman web yang berhubungan dengan typeface (jenis tulisan / huruf), bisa mengenai family-nya, ukuran, bold atau tidaknya dan lain-lain. slide bantuan untuk video youtube: https://youtu.be/nPHed3_oPvY

pemrogramancssdasar
HTML Dasar : #8 Image
HTML Dasar : #8 ImageHTML Dasar : #8 Image
HTML Dasar : #8 Image

Slide pendukung untuk mata kuliah Pemrograman Web 1 di Jurusan Teknik Informatika Universitas Pasundan Bandung. Digunakan juga sebagai pendukung untuk video di channel youtube "WebProgrammingUNPAS" https://www.youtube.com/channel/UCkXmLjEr95LVtGuIm3l2dPg

web designbandungindonesia
HTML Dasar : #10 Form
HTML Dasar : #10 FormHTML Dasar : #10 Form
HTML Dasar : #10 Form

Slide pendukung untuk mata kuliah Pemrograman Web 1 di Jurusan Teknik Informatika Universitas Pasundan Bandung. Digunakan juga sebagai pendukung untuk video di channel youtube "WebProgrammingUNPAS" https://www.youtube.com/channel/UCkXmLjEr95LVtGuIm3l2dPg

bandunghtmlweb design
Implement the following
Implement the following cart:
When the user clicks Add, the
item name, price and a Remove
button are added to the cart.
When the user clicks Remove, the
corresponding item is removed
from the cart.
There should be a Total Price that is
affected when an item is added or
removed.
Due date: 14-10-2017

More Related Content

What's hot

Java Script ppt
Java Script pptJava Script ppt
Java Script ppt
Priya Goyal
 
Javascript basics
Javascript basicsJavascript basics
Javascript basics
shreesenthil
 
javaScript.ppt
javaScript.pptjavaScript.ppt
javaScript.ppt
sentayehu
 
Js ppt
Js pptJs ppt
Js ppt
Rakhi Thota
 
jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginners
Arulmurugan Rajaraman
 
Css Ppt
Css PptCss Ppt
Css Ppt
Hema Prasanth
 
Javascript
JavascriptJavascript
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
Edureka!
 
JavaScript Tutorial
JavaScript  TutorialJavaScript  Tutorial
JavaScript Tutorial
Bui Kiet
 
CSS Basics
CSS BasicsCSS Basics
CSS Basics
WordPress Memphis
 
JavaScript Programming
JavaScript ProgrammingJavaScript Programming
JavaScript Programming
Sehwan Noh
 
Functions in javascript
Functions in javascriptFunctions in javascript
JavaScript - An Introduction
JavaScript - An IntroductionJavaScript - An Introduction
JavaScript - An Introduction
Manvendra Singh
 
3. Java Script
3. Java Script3. Java Script
3. Java Script
Jalpesh Vasa
 
Javascript essentials
Javascript essentialsJavascript essentials
Javascript essentials
Bedis ElAchèche
 
Javascript
JavascriptJavascript
Javascript
Vibhor Grover
 
HTML (Web) basics for a beginner
HTML (Web) basics for a beginnerHTML (Web) basics for a beginner
HTML (Web) basics for a beginner
Jayapal Reddy Nimmakayala
 
cascading style sheet ppt
cascading style sheet pptcascading style sheet ppt
cascading style sheet ppt
abhilashagupta
 
Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)
Chris Poteet
 
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
Fahim Abdullah
 

What's hot (20)

Java Script ppt
Java Script pptJava Script ppt
Java Script ppt
 
Javascript basics
Javascript basicsJavascript basics
Javascript basics
 
javaScript.ppt
javaScript.pptjavaScript.ppt
javaScript.ppt
 
Js ppt
Js pptJs ppt
Js ppt
 
jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginners
 
Css Ppt
Css PptCss Ppt
Css Ppt
 
Javascript
JavascriptJavascript
Javascript
 
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
 
JavaScript Tutorial
JavaScript  TutorialJavaScript  Tutorial
JavaScript Tutorial
 
CSS Basics
CSS BasicsCSS Basics
CSS Basics
 
JavaScript Programming
JavaScript ProgrammingJavaScript Programming
JavaScript Programming
 
Functions in javascript
Functions in javascriptFunctions in javascript
Functions in javascript
 
JavaScript - An Introduction
JavaScript - An IntroductionJavaScript - An Introduction
JavaScript - An Introduction
 
3. Java Script
3. Java Script3. Java Script
3. Java Script
 
Javascript essentials
Javascript essentialsJavascript essentials
Javascript essentials
 
Javascript
JavascriptJavascript
Javascript
 
HTML (Web) basics for a beginner
HTML (Web) basics for a beginnerHTML (Web) basics for a beginner
HTML (Web) basics for a beginner
 
cascading style sheet ppt
cascading style sheet pptcascading style sheet ppt
cascading style sheet ppt
 
Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)
 
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
 

Viewers also liked

Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
Bryan Basham
 
Understanding the Computer System
Understanding the Computer SystemUnderstanding the Computer System
Understanding the Computer System
Sheryl Nelmida
 
CSS Dasar #2 : Anatomy CSS
CSS Dasar #2 : Anatomy CSSCSS Dasar #2 : Anatomy CSS
CSS Dasar #2 : Anatomy CSS
Sandhika Galih
 
CSS Layouting #5 : Position
CSS Layouting #5 : PositionCSS Layouting #5 : Position
CSS Layouting #5 : Position
Sandhika Galih
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
Walid Ashraf
 
HTML Dasar : #9 Tabel
HTML Dasar : #9 TabelHTML Dasar : #9 Tabel
HTML Dasar : #9 Tabel
Sandhika Galih
 
CSS Layouting #2 : Dimensi & Overflow
CSS Layouting #2 : Dimensi & OverflowCSS Layouting #2 : Dimensi & Overflow
CSS Layouting #2 : Dimensi & Overflow
Sandhika Galih
 
HTML Dasar : #6 List
HTML Dasar : #6 ListHTML Dasar : #6 List
HTML Dasar : #6 List
Sandhika Galih
 
CSS Layouting #1 : Display
CSS Layouting #1 : DisplayCSS Layouting #1 : Display
CSS Layouting #1 : Display
Sandhika Galih
 
CSS Box Model
CSS Box ModelCSS Box Model
CSS Box Model
Gerson Abesamis
 
CSS Dasar #4 : Font Styling
CSS Dasar #4 : Font StylingCSS Dasar #4 : Font Styling
CSS Dasar #4 : Font Styling
Sandhika Galih
 
HTML Dasar : #8 Image
HTML Dasar : #8 ImageHTML Dasar : #8 Image
HTML Dasar : #8 Image
Sandhika Galih
 
HTML Dasar : #10 Form
HTML Dasar : #10 FormHTML Dasar : #10 Form
HTML Dasar : #10 Form
Sandhika Galih
 
CSS Layouting #3 : Box Model
CSS Layouting #3 : Box ModelCSS Layouting #3 : Box Model
CSS Layouting #3 : Box Model
Sandhika Galih
 
CSS Layouting #4 : Float
CSS Layouting #4 : FloatCSS Layouting #4 : Float
CSS Layouting #4 : Float
Sandhika Galih
 
HTML Dasar : #7 Hyperlink
HTML Dasar : #7 HyperlinkHTML Dasar : #7 Hyperlink
HTML Dasar : #7 Hyperlink
Sandhika Galih
 
CSS Dasar #3 : Penempatan CSS
CSS Dasar #3 : Penempatan CSSCSS Dasar #3 : Penempatan CSS
CSS Dasar #3 : Penempatan CSS
Sandhika Galih
 
Ceramic
CeramicCeramic

Viewers also liked (18)

Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
 
Understanding the Computer System
Understanding the Computer SystemUnderstanding the Computer System
Understanding the Computer System
 
CSS Dasar #2 : Anatomy CSS
CSS Dasar #2 : Anatomy CSSCSS Dasar #2 : Anatomy CSS
CSS Dasar #2 : Anatomy CSS
 
CSS Layouting #5 : Position
CSS Layouting #5 : PositionCSS Layouting #5 : Position
CSS Layouting #5 : Position
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
 
HTML Dasar : #9 Tabel
HTML Dasar : #9 TabelHTML Dasar : #9 Tabel
HTML Dasar : #9 Tabel
 
CSS Layouting #2 : Dimensi & Overflow
CSS Layouting #2 : Dimensi & OverflowCSS Layouting #2 : Dimensi & Overflow
CSS Layouting #2 : Dimensi & Overflow
 
HTML Dasar : #6 List
HTML Dasar : #6 ListHTML Dasar : #6 List
HTML Dasar : #6 List
 
CSS Layouting #1 : Display
CSS Layouting #1 : DisplayCSS Layouting #1 : Display
CSS Layouting #1 : Display
 
CSS Box Model
CSS Box ModelCSS Box Model
CSS Box Model
 
CSS Dasar #4 : Font Styling
CSS Dasar #4 : Font StylingCSS Dasar #4 : Font Styling
CSS Dasar #4 : Font Styling
 
HTML Dasar : #8 Image
HTML Dasar : #8 ImageHTML Dasar : #8 Image
HTML Dasar : #8 Image
 
HTML Dasar : #10 Form
HTML Dasar : #10 FormHTML Dasar : #10 Form
HTML Dasar : #10 Form
 
CSS Layouting #3 : Box Model
CSS Layouting #3 : Box ModelCSS Layouting #3 : Box Model
CSS Layouting #3 : Box Model
 
CSS Layouting #4 : Float
CSS Layouting #4 : FloatCSS Layouting #4 : Float
CSS Layouting #4 : Float
 
HTML Dasar : #7 Hyperlink
HTML Dasar : #7 HyperlinkHTML Dasar : #7 Hyperlink
HTML Dasar : #7 Hyperlink
 
CSS Dasar #3 : Penempatan CSS
CSS Dasar #3 : Penempatan CSSCSS Dasar #3 : Penempatan CSS
CSS Dasar #3 : Penempatan CSS
 
Ceramic
CeramicCeramic
Ceramic
 

Similar to Lab #2: Introduction to Javascript

Will your code blend? : Toronto Code Camp 2010 : Barry Gervin
Will your code blend? : Toronto Code Camp 2010 : Barry GervinWill your code blend? : Toronto Code Camp 2010 : Barry Gervin
Will your code blend? : Toronto Code Camp 2010 : Barry Gervin
Barry Gervin
 
22519 - Client-Side Scripting Language (CSS) chapter 1 notes .pdf
22519 - Client-Side Scripting Language (CSS) chapter 1 notes .pdf22519 - Client-Side Scripting Language (CSS) chapter 1 notes .pdf
22519 - Client-Side Scripting Language (CSS) chapter 1 notes .pdf
sharvaridhokte
 
HSC INFORMATION TECHNOLOGY CHAPTER 3 ADVANCED JAVASCRIPT
HSC INFORMATION TECHNOLOGY CHAPTER 3 ADVANCED JAVASCRIPTHSC INFORMATION TECHNOLOGY CHAPTER 3 ADVANCED JAVASCRIPT
HSC INFORMATION TECHNOLOGY CHAPTER 3 ADVANCED JAVASCRIPT
AAFREEN SHAIKH
 
eXo SEA - JavaScript Introduction Training
eXo SEA - JavaScript Introduction TrainingeXo SEA - JavaScript Introduction Training
eXo SEA - JavaScript Introduction Training
Hoat Le
 
Intro to Javascript
Intro to JavascriptIntro to Javascript
Intro to Javascript
Anjan Banda
 
JavaScript & Dom Manipulation
JavaScript & Dom ManipulationJavaScript & Dom Manipulation
JavaScript & Dom Manipulation
Mohammed Arif
 
Wt unit 5
Wt unit 5Wt unit 5
Wt unit 5
team11vgnt
 
jQuery
jQueryjQuery
Basics of Java Script (JS)
Basics of Java Script (JS)Basics of Java Script (JS)
Basics of Java Script (JS)
Ajay Khatri
 
Java script tutorial
Java script tutorialJava script tutorial
Java script tutorial
Doeun KOCH
 
JavaScript
JavaScriptJavaScript
JavaScript
Ivano Malavolta
 
INTRODUCTION TO CLIENT SIDE PROGRAMMING
INTRODUCTION TO CLIENT SIDE PROGRAMMINGINTRODUCTION TO CLIENT SIDE PROGRAMMING
INTRODUCTION TO CLIENT SIDE PROGRAMMING
Prof Ansari
 
Java Web Programming [8/9] : JSF and AJAX
Java Web Programming [8/9] : JSF and AJAXJava Web Programming [8/9] : JSF and AJAX
Java Web Programming [8/9] : JSF and AJAX
IMC Institute
 
The Theory Of The Dom
The Theory Of The DomThe Theory Of The Dom
The Theory Of The Dom
kaven yan
 
Interoperable Component Patterns
Interoperable Component PatternsInteroperable Component Patterns
Interoperable Component Patterns
Matthew Beale
 
JavaScript
JavaScriptJavaScript
JavaScript
Bharti Gupta
 
Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development
Mahmoud Hamed Mahmoud
 
01 Introduction - JavaScript Development
01 Introduction - JavaScript Development01 Introduction - JavaScript Development
01 Introduction - JavaScript Development
Tommy Vercety
 
JS basics
JS basicsJS basics
JS basics
Mohd Saeed
 
Basic Java script handouts for students
Basic Java script handouts for students Basic Java script handouts for students
Basic Java script handouts for students
shafiq sangi
 

Similar to Lab #2: Introduction to Javascript (20)

Will your code blend? : Toronto Code Camp 2010 : Barry Gervin
Will your code blend? : Toronto Code Camp 2010 : Barry GervinWill your code blend? : Toronto Code Camp 2010 : Barry Gervin
Will your code blend? : Toronto Code Camp 2010 : Barry Gervin
 
22519 - Client-Side Scripting Language (CSS) chapter 1 notes .pdf
22519 - Client-Side Scripting Language (CSS) chapter 1 notes .pdf22519 - Client-Side Scripting Language (CSS) chapter 1 notes .pdf
22519 - Client-Side Scripting Language (CSS) chapter 1 notes .pdf
 
HSC INFORMATION TECHNOLOGY CHAPTER 3 ADVANCED JAVASCRIPT
HSC INFORMATION TECHNOLOGY CHAPTER 3 ADVANCED JAVASCRIPTHSC INFORMATION TECHNOLOGY CHAPTER 3 ADVANCED JAVASCRIPT
HSC INFORMATION TECHNOLOGY CHAPTER 3 ADVANCED JAVASCRIPT
 
eXo SEA - JavaScript Introduction Training
eXo SEA - JavaScript Introduction TrainingeXo SEA - JavaScript Introduction Training
eXo SEA - JavaScript Introduction Training
 
Intro to Javascript
Intro to JavascriptIntro to Javascript
Intro to Javascript
 
JavaScript & Dom Manipulation
JavaScript & Dom ManipulationJavaScript & Dom Manipulation
JavaScript & Dom Manipulation
 
Wt unit 5
Wt unit 5Wt unit 5
Wt unit 5
 
jQuery
jQueryjQuery
jQuery
 
Basics of Java Script (JS)
Basics of Java Script (JS)Basics of Java Script (JS)
Basics of Java Script (JS)
 
Java script tutorial
Java script tutorialJava script tutorial
Java script tutorial
 
JavaScript
JavaScriptJavaScript
JavaScript
 
INTRODUCTION TO CLIENT SIDE PROGRAMMING
INTRODUCTION TO CLIENT SIDE PROGRAMMINGINTRODUCTION TO CLIENT SIDE PROGRAMMING
INTRODUCTION TO CLIENT SIDE PROGRAMMING
 
Java Web Programming [8/9] : JSF and AJAX
Java Web Programming [8/9] : JSF and AJAXJava Web Programming [8/9] : JSF and AJAX
Java Web Programming [8/9] : JSF and AJAX
 
The Theory Of The Dom
The Theory Of The DomThe Theory Of The Dom
The Theory Of The Dom
 
Interoperable Component Patterns
Interoperable Component PatternsInteroperable Component Patterns
Interoperable Component Patterns
 
JavaScript
JavaScriptJavaScript
JavaScript
 
Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development
 
01 Introduction - JavaScript Development
01 Introduction - JavaScript Development01 Introduction - JavaScript Development
01 Introduction - JavaScript Development
 
JS basics
JS basicsJS basics
JS basics
 
Basic Java script handouts for students
Basic Java script handouts for students Basic Java script handouts for students
Basic Java script handouts for students
 

Recently uploaded

7 Most Powerful Solar Storms in the History of Earth.pdf
7 Most Powerful Solar Storms in the History of Earth.pdf7 Most Powerful Solar Storms in the History of Earth.pdf
7 Most Powerful Solar Storms in the History of Earth.pdf
Enterprise Wired
 
Research Directions for Cross Reality Interfaces
Research Directions for Cross Reality InterfacesResearch Directions for Cross Reality Interfaces
Research Directions for Cross Reality Interfaces
Mark Billinghurst
 
Best Programming Language for Civil Engineers
Best Programming Language for Civil EngineersBest Programming Language for Civil Engineers
Best Programming Language for Civil Engineers
Awais Yaseen
 
Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...
Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...
Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...
Bert Blevins
 
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptxRPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
SynapseIndia
 
How Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdfHow Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdf
HackersList
 
Best Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdfBest Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdf
Tatiana Al-Chueyr
 
Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024
BookNet Canada
 
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-InTrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc
 
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Chris Swan
 
Quality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of TimeQuality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of Time
Aurora Consulting
 
The Rise of Supernetwork Data Intensive Computing
The Rise of Supernetwork Data Intensive ComputingThe Rise of Supernetwork Data Intensive Computing
The Rise of Supernetwork Data Intensive Computing
Larry Smarr
 
find out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challengesfind out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challenges
huseindihon
 
Implementations of Fused Deposition Modeling in real world
Implementations of Fused Deposition Modeling  in real worldImplementations of Fused Deposition Modeling  in real world
Implementations of Fused Deposition Modeling in real world
Emerging Tech
 
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - MydbopsScaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Mydbops
 
Manual | Product | Research Presentation
Manual | Product | Research PresentationManual | Product | Research Presentation
Manual | Product | Research Presentation
welrejdoall
 
Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...
Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...
Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...
Erasmo Purificato
 
Cookies program to display the information though cookie creation
Cookies program to display the information though cookie creationCookies program to display the information though cookie creation
Cookies program to display the information though cookie creation
shanthidl1
 
20240705 QFM024 Irresponsible AI Reading List June 2024
20240705 QFM024 Irresponsible AI Reading List June 202420240705 QFM024 Irresponsible AI Reading List June 2024
20240705 QFM024 Irresponsible AI Reading List June 2024
Matthew Sinclair
 
Recent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS InfrastructureRecent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS Infrastructure
KAMAL CHOUDHARY
 

Recently uploaded (20)

7 Most Powerful Solar Storms in the History of Earth.pdf
7 Most Powerful Solar Storms in the History of Earth.pdf7 Most Powerful Solar Storms in the History of Earth.pdf
7 Most Powerful Solar Storms in the History of Earth.pdf
 
Research Directions for Cross Reality Interfaces
Research Directions for Cross Reality InterfacesResearch Directions for Cross Reality Interfaces
Research Directions for Cross Reality Interfaces
 
Best Programming Language for Civil Engineers
Best Programming Language for Civil EngineersBest Programming Language for Civil Engineers
Best Programming Language for Civil Engineers
 
Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...
Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...
Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...
 
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptxRPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
 
How Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdfHow Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdf
 
Best Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdfBest Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdf
 
Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024
 
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-InTrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
 
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
 
Quality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of TimeQuality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of Time
 
The Rise of Supernetwork Data Intensive Computing
The Rise of Supernetwork Data Intensive ComputingThe Rise of Supernetwork Data Intensive Computing
The Rise of Supernetwork Data Intensive Computing
 
find out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challengesfind out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challenges
 
Implementations of Fused Deposition Modeling in real world
Implementations of Fused Deposition Modeling  in real worldImplementations of Fused Deposition Modeling  in real world
Implementations of Fused Deposition Modeling in real world
 
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - MydbopsScaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
 
Manual | Product | Research Presentation
Manual | Product | Research PresentationManual | Product | Research Presentation
Manual | Product | Research Presentation
 
Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...
Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...
Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...
 
Cookies program to display the information though cookie creation
Cookies program to display the information though cookie creationCookies program to display the information though cookie creation
Cookies program to display the information though cookie creation
 
20240705 QFM024 Irresponsible AI Reading List June 2024
20240705 QFM024 Irresponsible AI Reading List June 202420240705 QFM024 Irresponsible AI Reading List June 2024
20240705 QFM024 Irresponsible AI Reading List June 2024
 
Recent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS InfrastructureRecent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS Infrastructure
 

Lab #2: Introduction to Javascript

  • 2. Web Programming Programming for the World Wide Web involves Server-side programming Client-side (browser-side) programming
  • 3. What is JavaScript? JavaScript is used to program the behaviour of web pages (performing dynamic tasks). Javascript are scripts (code) that is executed on the client’s browser instead of the web-server (Client-side scripts).
  • 4. Why we need client side programming The user’s actions will result in an immediate response because they don't require a trip to the server.  Allows the creation of faster and more responsive web applications.  Make web pages more interactive Fewer resources are used and needed on the web-server.
  • 5. Characteristics of JavaScript Object-based • Doesn't support all the features of OOPs like Polymorphism and Inheritance Event-Driven • Much of the JavaScript code you write will be in response to events generated by the user or the system. Browser-Dependent • JavaScript depends on the Web browser to support it. If the browser does not support it, your code will be ignored. Even worse, the JavaScript code itself may be displayed as text on your page.
  • 6. Characteristics of JavaScript (cont.) Interpreted language • JavaScript is interpreted at runtime by the browser before it is executed. JavaScript is not compiled into an actual program like an .EXE file but remains part of the HTML document to which it is attached. Dynamic • You can declare variables of a specific type, but you do not need to Case sensitive
  • 7. What Javascript can do? Javascript can change HTML Content Javascript can change HTML Attributes Javascript can change HTML Styles (CSS) Javascript can Validate Data Javascript can Make Calculations
  • 8. Embedding JavaScript in HTML 1. Anywhere in the html file between <script></script> tags. 2. As the value of the event handler attributes.
  • 9. Embedding JavaScript in HTML 3. In an external file and refer to it using the SRC attribute. Note: Keeping all code in one place, is always a good habit.
  • 10. JavaScript Display Possibilities JavaScript can "display" data in different ways: Writing into an alert box, using window.alert(), window.prompt(), window.confirm(). Writing into an HTML element, using innerHTML.
  • 12. Prompts and Confirm Prompts :The return is the data the user entered The confirm returns true and false
  • 13. Events Event handlers are created as attributes added to the HTML tags in which the event is triggered. An Event handler adopts the event name and appends the word “on” in front of it. Thus the “click” event becomes the onclick event handler.
  • 14. Mouse Events Event handler Description onmousedown when pressing any of the mouse buttons. onmousemove when the user moves the mouse pointer within an element. onmouseout when moving the mouse pointer out of an element. onmouseup when the user releases any mouse button pressed onmouseover when the user moves the mouse pointer over an element. onclick when clicking the left mouse button on an element. ondblclick when Double-clicking the left mouse button on an element. ondragstart When the user has begun to select an element
  • 15. Keyboard Events Event handler Description onkeydown When User holds down a key onkeypress When User presses a key onkeyup When User releases the pressed a key
  • 16. JavaScript Functions A JavaScript function is a block of code designed to perform a particular task. A function is executed when "something" invokes it (calls it).  When an event occurs (when a user clicks a button)  When it is invoked (called) from JavaScript code  Automatically (self invoked)
  • 17. Function Invocation types When an event occurs (e.g. when a user clicks a button)
  • 18. Function Invocation types(cont.)  When it is invoked (called) from JavaScript code
  • 19. Function Invocation types (cont.)  Automatically (self invoked)
  • 20. Function Return When JavaScript reaches a return statement, the function will stop executing and returns some value to the invoker. If the function was invoked from a statement, JavaScript will "return" to execute the code after the invoking statement.
  • 21. JavaScript Built-in functions Name Example parseInt() parseInt("3") //returns 3 parseInt(“3a”) //returns 3 parseInt(“a3”) //returns NaN parseInt("110", 2)// returns 6 parseInt("0xD9", 16)// returns 217 parseFloat() parseFloat("3.55") //returns 3.55 parseFloat(“3.55a”) //returns 3.55 parseFloat(“a3.55”) //returns NaN Number() myVar = new Boolean("true") document.write(Number(myVar)) // returns 1 String() myVar = new Boolean(0) document.write(String(myVar)) // returns false
  • 22. JavaScript Built-in functions Name Description Example isFinite(num) (used to test number) returns true if the number is finite, else false document.write(isFinite(2.2345)) //returns true document.write(isFinite(“Hello”)) //returns false isNaN(val) (used to test value) validate the argument for a number and returns true if the given value is not a number else returns false. document.write(isNaN(0/0)) //returns true document.write(isNaN("348")) //returns false eval(expression) evaluates an expression and returns the result. f=999; w=777; document.write(eval(f + w)); // returns 1776
  • 23. JavaScript Built-in functions Name Description Example escape(string) method converts the special characters like space, colon etc. of the given string in to escape sequences. escape("test val"); //test%20val unescape(string) function replaces the escape sequences with original values. e.g. %20 is the escape sequence for space " ". unescape("test%20val"); //test val
  • 24. JavaScript Primitive Value types Value Example Number Any numeric value (e.g., 3, 5.3, or 45e8) String Any string of alphanumeric characters (e.g., "Hello, World!", "555-1212" or "KA12V2B334") Boolean True or False values only
  • 25. JavaScript Special Values Value Example Null Eg: var x = null; A special keyword for the null value (no value or empty variable) ** x has the type ‘object’ Undefined Eg: var x; A special keyword means that a value hasn't even been assigned yet. ** x has the type ‘undefined’
  • 26. JavaScript Variables Variables are containers that hold values. Variables are untyped The initial value for any variable is undefined. var num; //num = undefined  While it is not technically necessary, variable declarations should begin with the keyword var.
  • 27. JavaScript Variables Scope  Global Scope  Local Scope <script> x=1 var y=2 function MyFunction() { var z z=3 // the rest of the code } </script> Global scope Local scope
  • 28. Controlling Program Flow Program flow is normally linear Control Statements can change the program flow 1. Conditional Statements a. if ….else b. switch/case 2. Loop Statements a. for b. for..in loops through the properties of an object c. while d. do…while
  • 29. HTML DOM (Document Object Model) The HTML DOM is a standard for how to get, change, add, or delete HTML elements.
  • 30. Finding HTML Elements Method Description document.getElementById() Find an element by element id document.getElementsByTagName() Find elements by tag name document.getElementsByClassName() Find elements by class name
  • 31. Changing HTML elements Method Description element.innerHTML= Change the inner HTML of an element element.attribute= Change the attribute of an HTML element element.setAttribute(attribute,value) Change the attribute of an HTML element element.style.property= Change the style of an HTML element
  • 32. Adding and deleting elements Method Description document.createElement(...) Create an HTML element document.removeChild(...) Remove an HTML element document.appendChild(...) Add an HTML element document.replaceChild(...) Replace an HTML element document.write(text) Write into the HTML output stream
  • 33. The addEventListener() method Adds the function to an event attribute (onclick in this example) of the selected element
  • 34. The addEventListener() method Another way is to add only the name of the function and define it separately in your scripts
  • 35. HTML Forms and JavaScript HTML <form> elements receive input JavaScript is very good at processing user input in the web browser Forms and form elements have unique names Each unique element can be identified Uses JavaScript Document Object Model (DOM)
  • 37. Using Form data To access the values of the form element use the following syntax: document.formname.elementname.value Example document.addressform.yourname.value document.addressform.phone.value document.addressform.email.value
  • 41. Implement the following Implement the following cart: When the user clicks Add, the item name, price and a Remove button are added to the cart. When the user clicks Remove, the corresponding item is removed from the cart. There should be a Total Price that is affected when an item is added or removed. Due date: 14-10-2017