SlideShare a Scribd company logo
HTML & JavaScript Introduction
HTML & JavaScript Introduction
HTML & JavaScript Introduction
The	client
The	server
An	Internet	connection
TCP/IP
HTTP
DNS
HTML,	CSS,	&	JavaScript
Assets
HTML & JavaScript Introduction
HTML & JavaScript Introduction
<!DOCTYPE	html>
<html>
				<head>
								<meta	charset="UTF-8">
								<title>Title	of	the	document</title>
								<style>
</style>
				</head>
				<body>
								<h1>Header</h1>
								<p>First	paragraph	with	<em>emphasized	text</em>.</p>
								<p>Second	paragraph.</p>
								<script>
HTML & JavaScript Introduction
HTML	documents	are	delivered	as	"documents".		Then
web	browser	turns	them	into	the	Document	Object
Model	(DOM)	internal	representation.
HTML	documents	contain	tags,	but	do	not	contain	the
elements.	The	elements	are	only	generated	after	the
parsing	step,	from	these	tags.
HTML & JavaScript Introduction
Declared	by	prefixing	with	
var	a	=	1;
var	b	=	2,
				c	=	b;
Weakly	typed
var	a	=	2;
a	=	3.14;
a	=	'This	is	a	string';
Initialized	with	the	value	
var	a;
console.log(a);	//undefined
console.log(a	===	undefined);	//true
Primitive	values:
Number
String
Boolean
null
undefined
Object:
Function
Array
Date
RegExp
if(	a	>=	0){
				a++;
}	else	if(a	<	-1){
				a	*=	2;
}
switch(a){
				case	1:
								a	+=	1;
								break;
				case	2:	
								a	+=	2
								break;
				default:
								a	=	0;
}
for(	var	i	=	0;	i	<	5;	i++	)	{
		console.log(i);
}
while(a	<	100)	{
		a++;
}
do	{
		a++;
}	while(a	<	100);
Conditional:
Iterative	:
var	animal	=	{
		isDog:	true,
		name:	'Sparky',
		bark:	function(){
				return	'Bark!'
		}
}	
a	hash	of	 	pairs;
the	key	can	be	a	Number	or	a	String;
the	value	can	be	anything	and	it	can	be	called	a
;
if	a	value	is	a	function,	it	can	be	called	a	 .
Example:
also	objects;
have	numeric	properties	that	are	auto-incremented;
have	a	 property;
inherits	some	methods	like:
push();
splice();
sort();
join();
and	more.
var	array	=	[1,2,3];
console.log(array.length);	//3
array.push("a	value");
console.log(array.length);	//4
Example:
also	objects;
have	 and	 ;
can	be	copied,	deleted,	augmented;
special,	because	can	be	invoked;
all	functions	return	a	value	(implicitly	 );
can	return	other	functions.
//Function	Declaration
function	fn(x){
			return	x;
}
//Function	Expression
var	fn	=	function(){
			return	x;
}
Example:
return	 when	they	are	invoked	with	 ;
can	be	modified	before	it's	returned;
can	return	another	object.
var	Person	=	function(name){
			this.name	=	name;
			this.sayName	=	function(){
						return	'My	name	is	'	+	this.name;
			};
};
//Create	new	instance
var	john	=	new	Person('John');
>>	john.sayName();	//John
>>	john	instanceof	Person	//true
>>	john	instanceof	Object	//true
Example:
a	property	of	the	 ;
can	be	overwritten	or	augmented.
var	Person	=	function(name){
			this.name	=	name;
			this.sayName	=	function(){
						return	'My	name	is	'	+	this.name;
			};
};
//Create	new	instance
var	james=	new	Person('James');
//Augment	the	prototype	object
Person.prototype.changeName	=	function	(newName)	{
			this.name	=	newName;
};
james.changeName('Joe');
>>james.sayName();	//Joe
Example:
it's	not	directly	exposed	in	all	browsers;
it's	a	reference	to	constructor	 property.
var	Person	=	function(name){
			this.name	=	name;
};
Person.prototype.changeName	=	function	(newName)	{
			this.name	=	newName;
};
Person.prototype.sayName	=	function(){
			return	'My	name	is	'	+	this.name;
};
var	james=	new	Person('James');
>>	james.hasOwnProperty('changeName');	//false
>>	james.__proto__.hasOwnProperty('changeName');	//true
Example:
No	block	scope
if(true){
			var	inside	=	1;
}
>>inside	//1
Every	variable	is	global	unless	it’s	in	a	function	and	is
declared	with	
function	fn(){
			var	private	=	true;
			//private	it's	available	here
}
>>private	//undefined
(function(){
			var	a	=	1;
			var	b	=	2;
			alert(a	+	b);
})();
Closures	are	 that	refer	to	independent	(free)
variables.;
In	other	words,	the	function	defined	in	the	closure
' '	the	environment	in	which	it	was	created.	
(function(win){
		var	a	=	1,	
						b	=	2,
						sum	=	function(){
									//Closure	Function
									return	a	+	b;	
						}
		win.sum	=	sum;
})(window);
>>	sum()//3
//bad
for	(var	i	=	0;	i	<	5;	i++)	{	
			window.setTimeout(function(){	
						alert(i);	//	will	alert	5	every	time
			},	200);	
}	
//good
for	(var	i	=	0;	i	<	5;	i++)	{	
			(function(index)	{
						window.setTimeout(function()	{
										alert(index);	
						},	100);
			})(i);
}
Follows	the	prototype	model
One	object	can	 from	another
Functional	language
Can	pass	
A	function	can	 	another	 ( )
Dynamic:
Types	are	associated	with	values	-	not	variables
Define	new	program	elements	at	run	time
Weakly	typed:
Leave	out	 to	methods
Access	non-existing	object	properties
Truthy	and	falsy	values
Implicit	conversions:
HTML & JavaScript Introduction
the	 object	represents	the	window	of	your
browser	that	displays	the	 and	its	properties
include	all	the	global	variables;
the	 object	represents	the	displayed	HTML;
object	has	property	arrays	for	forms,	links,
images,	etc.	
of	a	 are	objects	with	data	and
operations,	the	data	being	their	properties.
<img	src="myImage.jpg"	alt="my	image">
img	=	{	src:	"myImage.jpg",	alt:	"my	image"	}
Example:
Javascript	possesses	incredibly	power,	it	can	manipulate	the	DOM	after
a	page	has	already	been	loaded
It	can	change	HTML	Elements
It	can	change	Attributes
It	can	modify	CSS
It	can	add	new	Elements	and	Attributes
It	can	delete	Elements
It	can	react	to	Events	in	a	page
document.getElementById("id");
document.getElementsByClassName("class_name");
document.getElementsByName("name");
document.getElementsByTag("tag_name");
So,	how	does	Javascript	Manipulate	the	DOM?
an	 is	a	notification	that	something	specific	has
occurred	in	the	browser
an	 	is	a	script	that	is	executed	in
response	to	the	appearance	of	an	
are	also	JavaScript	objects
Event	types:
click
keydown
mousedown
mouseout
mouseover
submit
much	more
<!--	HTML	-->
<button	id="myButton">Click	me</button>
//Js
var	element	=	document.getElementById('myButton');
function	eventHandler(){
				alert('You	have	clicked	the	button');
}
element.addEventListener('click',	eventHandler);
$("#myButton").on('click',	function(){
				alert('You	have	clicked	the	button');
});
Example	Link

More Related Content

What's hot (20)

PPT
Xhtml 2010
guest0f1e7f
 
PPS
Xhtml
Samir Sabry
 
ODP
Golang Template
Karthick Kumar
 
ODP
AD215 - Practical Magic with DXL
Stephan H. Wissel
 
PPT
Design Tools Html Xhtml
Ahsan Uddin Shan
 
PDF
JavaScript - Chapter 12 - Document Object Model
WebStackAcademy
 
PPTX
Html tag html 10 x10 wen liu art 2830
Wen Liu
 
DOCX
What is html xml and xhtml
FkdiMl
 
PPTX
Html (hyper text markup language)
Denni Domingo
 
PPTX
IPW HTML course
Vlad Posea
 
PDF
HTML literals, the JSX of the platform
Kenneth Rohde Christiansen
 
PPT
C5 Javascript
Vlad Posea
 
PPT
Xml
guestcacd813
 
PPTX
Session 3 Java Script
Muhammad Hesham
 
PPTX
Html5 tutorial
madhavforu
 
PPT
JavaScript Workshop
Pamela Fox
 
PDF
Client side scripting
Eleonora Ciceri
 
PPT
Origins and evolution of HTML and XHTML
Howpk
 
PPTX
Html vs xhtml
Yastee Shah
 
Xhtml 2010
guest0f1e7f
 
Golang Template
Karthick Kumar
 
AD215 - Practical Magic with DXL
Stephan H. Wissel
 
Design Tools Html Xhtml
Ahsan Uddin Shan
 
JavaScript - Chapter 12 - Document Object Model
WebStackAcademy
 
Html tag html 10 x10 wen liu art 2830
Wen Liu
 
What is html xml and xhtml
FkdiMl
 
Html (hyper text markup language)
Denni Domingo
 
IPW HTML course
Vlad Posea
 
HTML literals, the JSX of the platform
Kenneth Rohde Christiansen
 
C5 Javascript
Vlad Posea
 
Session 3 Java Script
Muhammad Hesham
 
Html5 tutorial
madhavforu
 
JavaScript Workshop
Pamela Fox
 
Client side scripting
Eleonora Ciceri
 
Origins and evolution of HTML and XHTML
Howpk
 
Html vs xhtml
Yastee Shah
 

Viewers also liked (20)

PPT
Web 2.0 Introduction
Steven Tuck
 
PPSX
Putting SOAP to REST
Igor Moochnick
 
PPTX
Fundamentos técnicos de internet
Aitor Andrés Sánchez
 
PPT
Fundamentos técnicos de internet
Sandra Cecilia Regel
 
PPTX
Fundamentos técnicos de internet
David Cava
 
PDF
Html,javascript & css
Predhin Sapru
 
PPTX
DNS & HTTP overview
Roman Wlodarski
 
PDF
An introduction to Web 2.0: The User Role
Kiko Llaneras
 
PPTX
Web basics
Sagar Pudi
 
PPT
Introduction to Web 2.0
Jane Hart
 
PPT
Dns introduction
sunil kumar
 
PPT
Web of Science: REST or SOAP?
Duncan Hull
 
PPTX
TCP/IP and DNS
Biswadip Dey
 
DOCX
Kanchan Ghangrekar_SrTestingAnalyst
Kanchan Ghangrekar
 
PPTX
TCP/IP Protocols
Danial Mirza
 
PPT
Software Deployment Principles & Practices
Thyagarajan Krishnan
 
PPTX
Web Application Development
Whytespace Ltd.
 
PDF
Restful web services by Sreeni Inturi
Sreeni I
 
PDF
Architecture of the Web browser
Sabin Buraga
 
PPTX
Front-end development introduction (HTML, CSS). Part 1
Oleksii Prohonnyi
 
Web 2.0 Introduction
Steven Tuck
 
Putting SOAP to REST
Igor Moochnick
 
Fundamentos técnicos de internet
Aitor Andrés Sánchez
 
Fundamentos técnicos de internet
Sandra Cecilia Regel
 
Fundamentos técnicos de internet
David Cava
 
Html,javascript & css
Predhin Sapru
 
DNS & HTTP overview
Roman Wlodarski
 
An introduction to Web 2.0: The User Role
Kiko Llaneras
 
Web basics
Sagar Pudi
 
Introduction to Web 2.0
Jane Hart
 
Dns introduction
sunil kumar
 
Web of Science: REST or SOAP?
Duncan Hull
 
TCP/IP and DNS
Biswadip Dey
 
Kanchan Ghangrekar_SrTestingAnalyst
Kanchan Ghangrekar
 
TCP/IP Protocols
Danial Mirza
 
Software Deployment Principles & Practices
Thyagarajan Krishnan
 
Web Application Development
Whytespace Ltd.
 
Restful web services by Sreeni Inturi
Sreeni I
 
Architecture of the Web browser
Sabin Buraga
 
Front-end development introduction (HTML, CSS). Part 1
Oleksii Prohonnyi
 
Ad

Similar to HTML & JavaScript Introduction (20)

PDF
Vskills angular js sample material
Vskills
 
PPTX
Dom date and objects and event handling
smitha273566
 
PPTX
Webdev bootcamp
DSCMESCOE
 
DOCX
DOM(Document Object Model) in javascript
Rashmi Mishra
 
PDF
WEB PROGRAMMING bharathiar university bca unitII
VinodhiniRavi2
 
PDF
html.pdf
ArianSS1
 
PPTX
WEB TECHNOLOGY Unit-4.pptx
karthiksmart21
 
PPTX
Introduction to HTML
Saleem Thapa
 
PPTX
Protocols and standards (http , html, xhtml, cgi, xml, wml, c html, etc)
techlovers3
 
PPTX
Java script
Adrian Caetano
 
PPTX
Unit5_Web_Updvvgxsvjbffcvvgbjifszated.pptx
1si23bt001
 
PPT
lecture 6 javascript event and event handling.ppt
ULADATZ
 
PDF
Java script
Yoga Raja
 
PPTX
Html (hypertext markup language)
Resty Jay Galdo
 
PPTX
Web technologies-course 09.pptx
Stefan Oprea
 
PPTX
Html lecture1
MuhammadFarooque11
 
PPT
JavaScript Basics with baby steps
Muhammad khurram khan
 
PPTX
Html-meeting1-1.pptx
YoussefAbobakr
 
PPTX
How to make Html
Meghal Murkute
 
PPTX
Html
Noha Sayed
 
Vskills angular js sample material
Vskills
 
Dom date and objects and event handling
smitha273566
 
Webdev bootcamp
DSCMESCOE
 
DOM(Document Object Model) in javascript
Rashmi Mishra
 
WEB PROGRAMMING bharathiar university bca unitII
VinodhiniRavi2
 
html.pdf
ArianSS1
 
WEB TECHNOLOGY Unit-4.pptx
karthiksmart21
 
Introduction to HTML
Saleem Thapa
 
Protocols and standards (http , html, xhtml, cgi, xml, wml, c html, etc)
techlovers3
 
Java script
Adrian Caetano
 
Unit5_Web_Updvvgxsvjbffcvvgbjifszated.pptx
1si23bt001
 
lecture 6 javascript event and event handling.ppt
ULADATZ
 
Java script
Yoga Raja
 
Html (hypertext markup language)
Resty Jay Galdo
 
Web technologies-course 09.pptx
Stefan Oprea
 
Html lecture1
MuhammadFarooque11
 
JavaScript Basics with baby steps
Muhammad khurram khan
 
Html-meeting1-1.pptx
YoussefAbobakr
 
How to make Html
Meghal Murkute
 
Ad

More from Alexe Bogdan (8)

PDF
Angular promises and http
Alexe Bogdan
 
PDF
Dependency Injection pattern in Angular
Alexe Bogdan
 
PDF
Client Side MVC & Angular
Alexe Bogdan
 
PDF
Angular custom directives
Alexe Bogdan
 
PDF
Angular server-side communication
Alexe Bogdan
 
PDF
Angular Promises and Advanced Routing
Alexe Bogdan
 
PDF
AngularJS - dependency injection
Alexe Bogdan
 
PDF
AngularJS - introduction & how it works?
Alexe Bogdan
 
Angular promises and http
Alexe Bogdan
 
Dependency Injection pattern in Angular
Alexe Bogdan
 
Client Side MVC & Angular
Alexe Bogdan
 
Angular custom directives
Alexe Bogdan
 
Angular server-side communication
Alexe Bogdan
 
Angular Promises and Advanced Routing
Alexe Bogdan
 
AngularJS - dependency injection
Alexe Bogdan
 
AngularJS - introduction & how it works?
Alexe Bogdan
 

Recently uploaded (20)

PPTX
L1A Season 1 ENGLISH made by A hegy fixed
toszolder91
 
PDF
Cleaning up your RPKI invalids, presented at PacNOG 35
APNIC
 
PDF
Paper: Quantum Financial System - DeFi patent wars
Steven McGee
 
PPTX
Presentation3gsgsgsgsdfgadgsfgfgsfgagsfgsfgzfdgsdgs.pptx
SUB03
 
PPTX
internet básico presentacion es una red global
70965857
 
PPTX
Softuni - Psychology of entrepreneurship
Kalin Karakehayov
 
PPTX
ONLINE BIRTH CERTIFICATE APPLICATION SYSYTEM PPT.pptx
ShyamasreeDutta
 
PPTX
04 Output 1 Instruments & Tools (3).pptx
GEDYIONGebre
 
PDF
The Internet - By the numbers, presented at npNOG 11
APNIC
 
PPT
Agilent Optoelectronic Solutions for Mobile Application
andreashenniger2
 
PDF
The-Hidden-Dangers-of-Skipping-Penetration-Testing.pdf.pdf
naksh4thra
 
PPTX
L1A Season 1 Guide made by A hegy Eng Grammar fixed
toszolder91
 
PPTX
法国巴黎第二大学本科毕业证{Paris 2学费发票Paris 2成绩单}办理方法
Taqyea
 
PDF
Top 10 Testing Procedures to Ensure Your Magento to Shopify Migration Success...
CartCoders
 
PPTX
Orchestrating things in Angular application
Peter Abraham
 
DOCX
Custom vs. Off-the-Shelf Banking Software
KristenCarter35
 
PDF
Build Fast, Scale Faster: Milvus vs. Zilliz Cloud for Production-Ready AI
Zilliz
 
PPT
introductio to computers by arthur janry
RamananMuthukrishnan
 
PDF
BRKACI-1003 ACI Brownfield Migration - Real World Experiences and Best Practi...
fcesargonca
 
PDF
Boardroom AI: The Next 10 Moves | Cerebraix Talent Tech
Cerebraix Technologies
 
L1A Season 1 ENGLISH made by A hegy fixed
toszolder91
 
Cleaning up your RPKI invalids, presented at PacNOG 35
APNIC
 
Paper: Quantum Financial System - DeFi patent wars
Steven McGee
 
Presentation3gsgsgsgsdfgadgsfgfgsfgagsfgsfgzfdgsdgs.pptx
SUB03
 
internet básico presentacion es una red global
70965857
 
Softuni - Psychology of entrepreneurship
Kalin Karakehayov
 
ONLINE BIRTH CERTIFICATE APPLICATION SYSYTEM PPT.pptx
ShyamasreeDutta
 
04 Output 1 Instruments & Tools (3).pptx
GEDYIONGebre
 
The Internet - By the numbers, presented at npNOG 11
APNIC
 
Agilent Optoelectronic Solutions for Mobile Application
andreashenniger2
 
The-Hidden-Dangers-of-Skipping-Penetration-Testing.pdf.pdf
naksh4thra
 
L1A Season 1 Guide made by A hegy Eng Grammar fixed
toszolder91
 
法国巴黎第二大学本科毕业证{Paris 2学费发票Paris 2成绩单}办理方法
Taqyea
 
Top 10 Testing Procedures to Ensure Your Magento to Shopify Migration Success...
CartCoders
 
Orchestrating things in Angular application
Peter Abraham
 
Custom vs. Off-the-Shelf Banking Software
KristenCarter35
 
Build Fast, Scale Faster: Milvus vs. Zilliz Cloud for Production-Ready AI
Zilliz
 
introductio to computers by arthur janry
RamananMuthukrishnan
 
BRKACI-1003 ACI Brownfield Migration - Real World Experiences and Best Practi...
fcesargonca
 
Boardroom AI: The Next 10 Moves | Cerebraix Talent Tech
Cerebraix Technologies
 

HTML & JavaScript Introduction