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
HTML guide for beginners
Thesis Scientist Private Limited
 
PPT
DOM Quick Overview
Signure Technologies
 
PPTX
HTML Course-PPT for all types of beginners.pptx
HarshSahu509641
 
PPTX
Introduction to HTML: Overview and Structure
JM PALEN
 
PPTX
Html Guide
Jspider - Noida
 
PPTX
HTML Introduction
eceklu
 
PPTX
HTML.pptx
Akhilapatil4
 
PDF
Html tutorial
NAGARAJU MAMILLAPALLY
 
PDF
Html full
GulshanKumar368
 
DOCX
Html.docx
Noman Ali
 
PPTX
Html ppt
Ruchi Kumari
 
PPTX
WEBSITE DEVELOPMENT,HTML is the standard markup language for creating Web pag...
johnmngoya1
 
PDF
WEB DESIGN AND INTERNET PROGRAMMING LAB MANUAL.pdf
mmgg1621
 
DOCX
Lesson A.1 - Introduction to Web Development.docx
MarlonMagtibay3
 
PPTX
Introduction to HTML.pptx
VaibhavSingh887876
 
PPTX
Basic HTML
Sayan De
 
PPTX
Lectuer html1
Nawal Alragawi
 
PPT
Intr to-html-xhtml-1233508169541646-3
bluejayjunior
 
PDF
1-learning-basic-html-intro-to-web-development.pdf
MohamedPalastine
 
HTML guide for beginners
Thesis Scientist Private Limited
 
DOM Quick Overview
Signure Technologies
 
HTML Course-PPT for all types of beginners.pptx
HarshSahu509641
 
Introduction to HTML: Overview and Structure
JM PALEN
 
Html Guide
Jspider - Noida
 
HTML Introduction
eceklu
 
HTML.pptx
Akhilapatil4
 
Html tutorial
NAGARAJU MAMILLAPALLY
 
Html full
GulshanKumar368
 
Html.docx
Noman Ali
 
Html ppt
Ruchi Kumari
 
WEBSITE DEVELOPMENT,HTML is the standard markup language for creating Web pag...
johnmngoya1
 
WEB DESIGN AND INTERNET PROGRAMMING LAB MANUAL.pdf
mmgg1621
 
Lesson A.1 - Introduction to Web Development.docx
MarlonMagtibay3
 
Introduction to HTML.pptx
VaibhavSingh887876
 
Basic HTML
Sayan De
 
Lectuer html1
Nawal Alragawi
 
Intr to-html-xhtml-1233508169541646-3
bluejayjunior
 
1-learning-basic-html-intro-to-web-development.pdf
MohamedPalastine
 
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
Powerpoint Slides: Eco Economic Epochs.pptx
Steven McGee
 
PDF
DevOps Design for different deployment options
henrymails
 
PPTX
英国假毕业证诺森比亚大学成绩单GPA修改UNN学生卡网上可查学历成绩单
Taqyea
 
PPTX
Template Timeplan & Roadmap Product.pptx
ImeldaYulistya
 
PPTX
一比一原版(LaTech毕业证)路易斯安那理工大学毕业证如何办理
Taqyea
 
PDF
Azure_DevOps introduction for CI/CD and Agile
henrymails
 
PPTX
unit 2_2 copy right fdrgfdgfai and sm.pptx
nepmithibai2024
 
PDF
How to Fix Error Code 16 in Adobe Photoshop A Step-by-Step Guide.pdf
Becky Lean
 
PDF
AI_MOD_1.pdf artificial intelligence notes
shreyarrce
 
PPTX
Random Presentation By Fuhran Khalil uio
maniieiish
 
PPTX
sajflsajfljsdfljslfjslfsdfas;fdsfksadfjlsdflkjslgfs;lfjlsajfl;sajfasfd.pptx
theknightme
 
PPTX
原版西班牙莱昂大学毕业证(León毕业证书)如何办理
Taqyea
 
PPTX
Optimization_Techniques_ML_Presentation.pptx
farispalayi
 
PPTX
ZARA-Case.pptx djdkkdjnddkdoodkdxjidjdnhdjjdjx
RonnelPineda2
 
PPTX
Research Design - Report on seminar in thesis writing. PPTX
arvielobos1
 
PPTX
PE introd.pptxfrgfgfdgfdgfgrtretrt44t444
nepmithibai2024
 
PPTX
西班牙武康大学毕业证书{UCAMOfferUCAM成绩单水印}原版制作
Taqyea
 
PPTX
L1A Season 1 Guide made by A hegy Eng Grammar fixed
toszolder91
 
PPTX
ONLINE BIRTH CERTIFICATE APPLICATION SYSYTEM PPT.pptx
ShyamasreeDutta
 
PPTX
Cost_of_Quality_Presentation_Software_Engineering.pptx
farispalayi
 
Powerpoint Slides: Eco Economic Epochs.pptx
Steven McGee
 
DevOps Design for different deployment options
henrymails
 
英国假毕业证诺森比亚大学成绩单GPA修改UNN学生卡网上可查学历成绩单
Taqyea
 
Template Timeplan & Roadmap Product.pptx
ImeldaYulistya
 
一比一原版(LaTech毕业证)路易斯安那理工大学毕业证如何办理
Taqyea
 
Azure_DevOps introduction for CI/CD and Agile
henrymails
 
unit 2_2 copy right fdrgfdgfai and sm.pptx
nepmithibai2024
 
How to Fix Error Code 16 in Adobe Photoshop A Step-by-Step Guide.pdf
Becky Lean
 
AI_MOD_1.pdf artificial intelligence notes
shreyarrce
 
Random Presentation By Fuhran Khalil uio
maniieiish
 
sajflsajfljsdfljslfjslfsdfas;fdsfksadfjlsdflkjslgfs;lfjlsajfl;sajfasfd.pptx
theknightme
 
原版西班牙莱昂大学毕业证(León毕业证书)如何办理
Taqyea
 
Optimization_Techniques_ML_Presentation.pptx
farispalayi
 
ZARA-Case.pptx djdkkdjnddkdoodkdxjidjdnhdjjdjx
RonnelPineda2
 
Research Design - Report on seminar in thesis writing. PPTX
arvielobos1
 
PE introd.pptxfrgfgfdgfdgfgrtretrt44t444
nepmithibai2024
 
西班牙武康大学毕业证书{UCAMOfferUCAM成绩单水印}原版制作
Taqyea
 
L1A Season 1 Guide made by A hegy Eng Grammar fixed
toszolder91
 
ONLINE BIRTH CERTIFICATE APPLICATION SYSYTEM PPT.pptx
ShyamasreeDutta
 
Cost_of_Quality_Presentation_Software_Engineering.pptx
farispalayi
 

HTML & JavaScript Introduction