SlideShare una empresa de Scribd logo
1 de 15
Chapter 4
Introduction to Javascript
Internet Programming (TAB1033)
mnibrahim@gmail.com
Objectives
By the end of this lecture, students will be able to:
► grasp the basic concepts of javascript and DOM
► describe the Client-Server Model
► differentiate between client-side scripting and
server-side scripting
► develop a simple javascript that involves simple
arithmetic operations
2 of 15
Agenda
► Javascript is NOT Java programming language
► What is javascript?
► Why learn javascript?
► Client- Server Model
► Where Javascript Can Be Located?
► Processing User Input, DOM.
► e.g @the cashier
► References
3 of 15
Javascript is NOT Java
Java
► developed by SUN
► a powerful OO
programming language .
► involved compiling java
code into executable
applications.
► Java programs created
for use in a web page is
called APPLET.
javascript
► Designed by Netscape
► A powerful OO scripting
language
► Need an interpreter
(Browser dependent)
► To enhance the
interactivity of web
pages
4 of 15
What is Javascript?
► JavaScript is a scripting languages (lightweight)
► It is usually embedded directly into an HTML doc
► Is an interpreted language – browser dependent
► JavaScript provides a programming language that
allows pages to escape from being static marked-
up information. – dynamic & interactive
► JavaScript is used in millions of Web pages to add
functionality, validate forms, detect browsers,
and much more. It is free!!!
► Pages that think.
5 of 15
Why learn JavaScript?
► JavaScript gives HTML designers a
programming tool - HTML authors are normally
not programmers, but JavaScript is a scripting
language with a very simple syntax! Almost
anyone can put small "snippets" of code into their
HTML pages
► JavaScript can put dynamic text into an HTML
page - A JavaScript statement like this:
document.write("<h1>" + name + "</h1>") can
write a variable text into an HTML page
6 of 15
…Why learn JavaScript?
► JavaScript can react to events - A JavaScript can
be set to execute when something happens, like
when a page has finished loading or when a user
clicks on an HTML element
► JavaScript can read and write HTML elements -
A JavaScript can read and change the content of
an HTML element
► JavaScript can be used to validate data - A
JavaScript can be used to validate form data
before it is submitted to a server.
7 of 15
…Why learn JavaScript?
► JavaScript can be used to detect the visitor's
browser - A JavaScript can be used to detect the
visitor's browser, and - depending on the browser
- load another page specifically designed for that
browser
► JavaScript can be used to create cookies - A
JavaScript can be used to store and retrieve
information on the visitor's computer
8 of 15
The Client-Server Model
Client Side Scripting
9 of 15
...The Client-Server Model
Server Side Scripting
10 of 15
Where Javascript Can Be Located?
1. In the <body> section
 eg_js_01_body.html
2. In the <head> section
 eg_js_01_head.html
3. As an external file
 eg_js_01_external.html
11 of 15
Processing User Input
► Javascript uses XHTML Documents Object Model
(DOM) to process user input
► View a list of available objects
http://www.w3schools.com/js/js_obj_htmldom.asp
► javascript event reference
http://www.w3schools.com/jsref/jsref_events.asp
► Click eg_js_02.html to view an example of DOM
and onchange() event.
► eg_js_01.html example of event, onclick().
12 of 15
Arithmetic Operator
Operator Description Example Result
+ Addition z = 5 + 4; z = 9
- Subtraction z = 5 – 4; z = 1
* Multiplication z = 5 * 4; z = 20
/ Division z = 5 / 4; z = 1.25
% Modulus
(remainder)
z = 5 % 4; z = 1
++ Increment z = 1;
y = ++z;
y = 2
-- Decrement z = 1;
y = --z;
y = 0
13 of 15
Simple Application @the Cashier
► A working example. eg_cashier_js.html
14 of 15
References
► http://www.w3schools.com/css/css_reference.asp
15 of 15

Más contenido relacionado

La actualidad más candente

Calc shipping
Calc shippingCalc shipping
Calc shipping
LAGirl
 
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 2...
 Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 2... Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 2...
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 2...
WebStackAcademy
 
NodeJs Intro - JavaScript Zagreb Meetup #1
NodeJs Intro - JavaScript Zagreb Meetup #1NodeJs Intro - JavaScript Zagreb Meetup #1
NodeJs Intro - JavaScript Zagreb Meetup #1
Tomislav Capan
 
introduction to the document object model- Dom chapter5
introduction to the document object model- Dom chapter5introduction to the document object model- Dom chapter5
introduction to the document object model- Dom chapter5
FLYMAN TECHNOLOGY LIMITED
 

La actualidad más candente (17)

Course Document
Course DocumentCourse Document
Course Document
 
Introduction To JavaScript Ajax
Introduction To JavaScript AjaxIntroduction To JavaScript Ajax
Introduction To JavaScript Ajax
 
Learn JavaScript From Scratch
Learn JavaScript From ScratchLearn JavaScript From Scratch
Learn JavaScript From Scratch
 
Calc shipping
Calc shippingCalc shipping
Calc shipping
 
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 2...
 Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 2... Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 2...
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 2...
 
Build web server
Build web serverBuild web server
Build web server
 
Upstate CSCI 450 jQuery
Upstate CSCI 450 jQueryUpstate CSCI 450 jQuery
Upstate CSCI 450 jQuery
 
Full stack java script development
Full stack java script developmentFull stack java script development
Full stack java script development
 
Javascript debugging
Javascript debuggingJavascript debugging
Javascript debugging
 
NodeJs Intro - JavaScript Zagreb Meetup #1
NodeJs Intro - JavaScript Zagreb Meetup #1NodeJs Intro - JavaScript Zagreb Meetup #1
NodeJs Intro - JavaScript Zagreb Meetup #1
 
Coldfusion with Keith Diehl
Coldfusion with Keith DiehlColdfusion with Keith Diehl
Coldfusion with Keith Diehl
 
Dom(document object model)
Dom(document object model)Dom(document object model)
Dom(document object model)
 
Learn VBScript – Part 1 of 4
Learn VBScript – Part 1 of 4Learn VBScript – Part 1 of 4
Learn VBScript – Part 1 of 4
 
1. introduction to java script
1. introduction to java script1. introduction to java script
1. introduction to java script
 
Ui automation
Ui automationUi automation
Ui automation
 
introduction to the document object model- Dom chapter5
introduction to the document object model- Dom chapter5introduction to the document object model- Dom chapter5
introduction to the document object model- Dom chapter5
 
자바스크립트 공부를 위한 책 소개
자바스크립트 공부를 위한 책 소개자바스크립트 공부를 위한 책 소개
자바스크립트 공부를 위한 책 소개
 

Destacado

An introduction to KnockoutJS
An introduction to KnockoutJSAn introduction to KnockoutJS
An introduction to KnockoutJS
mattbrailsford
 
01. session 01 introduction to html
01. session 01   introduction to html01. session 01   introduction to html
01. session 01 introduction to html
Phúc Đỗ
 
HTML Introduction
HTML IntroductionHTML Introduction
HTML Introduction
c525600
 

Destacado (20)

Knockout js
Knockout jsKnockout js
Knockout js
 
Knockout JS Development - a Quick Understanding
Knockout JS Development - a Quick UnderstandingKnockout JS Development - a Quick Understanding
Knockout JS Development - a Quick Understanding
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTML
 
(Fast) Introduction to HTML & CSS
(Fast) Introduction to HTML & CSS (Fast) Introduction to HTML & CSS
(Fast) Introduction to HTML & CSS
 
Ejercicio final unidad 2
Ejercicio final unidad 2Ejercicio final unidad 2
Ejercicio final unidad 2
 
Knockout.js
Knockout.jsKnockout.js
Knockout.js
 
Knockout js
Knockout jsKnockout js
Knockout js
 
Knockout (support slides for presentation)
Knockout (support slides for presentation)Knockout (support slides for presentation)
Knockout (support slides for presentation)
 
Html introduction by ikram niaz
Html introduction by ikram niazHtml introduction by ikram niaz
Html introduction by ikram niaz
 
Knockoutjs
KnockoutjsKnockoutjs
Knockoutjs
 
Knockout js (Dennis Haney)
Knockout js (Dennis Haney)Knockout js (Dennis Haney)
Knockout js (Dennis Haney)
 
Knockout js
Knockout jsKnockout js
Knockout js
 
An introduction to KnockoutJS
An introduction to KnockoutJSAn introduction to KnockoutJS
An introduction to KnockoutJS
 
Knockout js
Knockout jsKnockout js
Knockout js
 
01. session 01 introduction to html
01. session 01   introduction to html01. session 01   introduction to html
01. session 01 introduction to html
 
Knockout
KnockoutKnockout
Knockout
 
Knockout Introduction
Knockout IntroductionKnockout Introduction
Knockout Introduction
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTML
 
HTML Introduction
HTML IntroductionHTML Introduction
HTML Introduction
 
HTML Introduction
HTML IntroductionHTML Introduction
HTML Introduction
 

Similar a Introduction to Javascript

An Introduction to Ajax Programming
An Introduction to Ajax ProgrammingAn Introduction to Ajax Programming
An Introduction to Ajax Programming
hchen1
 
Iwt note(module 2)
Iwt note(module 2)Iwt note(module 2)
Iwt note(module 2)
SANTOSH RATH
 

Similar a Introduction to Javascript (20)

JAVA SCRIPT
JAVA SCRIPTJAVA SCRIPT
JAVA SCRIPT
 
Java script Basic
Java script BasicJava script Basic
Java script Basic
 
Javascript tutorial
Javascript tutorialJavascript tutorial
Javascript tutorial
 
Unit 4 Java script.pptx
Unit 4 Java script.pptxUnit 4 Java script.pptx
Unit 4 Java script.pptx
 
Basic Java script handouts for students
Basic Java script handouts for students Basic Java script handouts for students
Basic Java script handouts for students
 
JAVA SCRIPT
JAVA SCRIPTJAVA SCRIPT
JAVA SCRIPT
 
Java script
Java scriptJava script
Java script
 
Unit 4(it workshop)
Unit 4(it workshop)Unit 4(it workshop)
Unit 4(it workshop)
 
An Introduction to Ajax Programming
An Introduction to Ajax ProgrammingAn Introduction to Ajax Programming
An Introduction to Ajax Programming
 
Javascript - Ebook (A Quick Guide)
Javascript - Ebook (A Quick Guide)Javascript - Ebook (A Quick Guide)
Javascript - Ebook (A Quick Guide)
 
JS BASICS JAVA SCRIPT SCRIPTING
JS BASICS JAVA SCRIPT SCRIPTINGJS BASICS JAVA SCRIPT SCRIPTING
JS BASICS JAVA SCRIPT SCRIPTING
 
Java script by Act Academy
Java script by Act AcademyJava script by Act Academy
Java script by Act Academy
 
Iwt note(module 2)
Iwt note(module 2)Iwt note(module 2)
Iwt note(module 2)
 
Session vii(java scriptbasics)
Session vii(java scriptbasics)Session vii(java scriptbasics)
Session vii(java scriptbasics)
 
8.-Javascript-report powerpoint presentation
8.-Javascript-report powerpoint presentation8.-Javascript-report powerpoint presentation
8.-Javascript-report powerpoint presentation
 
Java scipt
Java sciptJava scipt
Java scipt
 
JavaScripts & jQuery
JavaScripts & jQueryJavaScripts & jQuery
JavaScripts & jQuery
 
06 Javascript
06 Javascript06 Javascript
06 Javascript
 
Java script Session No 1
Java script Session No 1Java script Session No 1
Java script Session No 1
 
Javascript
JavascriptJavascript
Javascript
 

Más de Firdaus Adib

Final Paper UTP Algorithm Data Structure January 2010
Final Paper UTP Algorithm Data Structure January 2010Final Paper UTP Algorithm Data Structure January 2010
Final Paper UTP Algorithm Data Structure January 2010
Firdaus Adib
 
Additional exercise for apa references
Additional exercise for apa referencesAdditional exercise for apa references
Additional exercise for apa references
Firdaus Adib
 

Más de Firdaus Adib (20)

Rule Based Architecture System
Rule Based Architecture SystemRule Based Architecture System
Rule Based Architecture System
 
Wireless Technology Proj spec
Wireless Technology Proj spec Wireless Technology Proj spec
Wireless Technology Proj spec
 
Corporate Ethics January 2010
Corporate Ethics January 2010Corporate Ethics January 2010
Corporate Ethics January 2010
 
Corporate Ethics July 2008
Corporate Ethics July 2008Corporate Ethics July 2008
Corporate Ethics July 2008
 
Final Paper UTP Web Development Application July 2008
Final Paper UTP Web Development Application July 2008Final Paper UTP Web Development Application July 2008
Final Paper UTP Web Development Application July 2008
 
Final Paper UTP Algorithm Data Structure July 2008
Final Paper UTP Algorithm Data Structure July 2008Final Paper UTP Algorithm Data Structure July 2008
Final Paper UTP Algorithm Data Structure July 2008
 
Final Paper UTP Web Development Application January 2010
Final Paper UTP Web Development Application January 2010Final Paper UTP Web Development Application January 2010
Final Paper UTP Web Development Application January 2010
 
Final Paper UTP Algorithm Data Structure January 2010
Final Paper UTP Algorithm Data Structure January 2010Final Paper UTP Algorithm Data Structure January 2010
Final Paper UTP Algorithm Data Structure January 2010
 
Final Paper UTP Web Development Application July 2009
Final Paper UTP Web Development Application July 2009Final Paper UTP Web Development Application July 2009
Final Paper UTP Web Development Application July 2009
 
PHP - Getting good with MySQL part II
 PHP - Getting good with MySQL part II PHP - Getting good with MySQL part II
PHP - Getting good with MySQL part II
 
PHP - Getting good with MySQL part I
PHP - Getting good with MySQL part IPHP - Getting good with MySQL part I
PHP - Getting good with MySQL part I
 
Php - Getting good with session
Php - Getting good with sessionPhp - Getting good with session
Php - Getting good with session
 
PHP - Getting good with cookies
PHP - Getting good with cookiesPHP - Getting good with cookies
PHP - Getting good with cookies
 
Javascript - Getting Good with Object
Javascript - Getting Good with ObjectJavascript - Getting Good with Object
Javascript - Getting Good with Object
 
Javascript - Getting Good with Loop and Array
Javascript - Getting Good with Loop and ArrayJavascript - Getting Good with Loop and Array
Javascript - Getting Good with Loop and Array
 
Additional exercise for apa references
Additional exercise for apa referencesAdditional exercise for apa references
Additional exercise for apa references
 
Chapter 2 summarising
Chapter 2 summarisingChapter 2 summarising
Chapter 2 summarising
 
American psychological association (apa)
American psychological association (apa)American psychological association (apa)
American psychological association (apa)
 
Referencing and Citing
Referencing and CitingReferencing and Citing
Referencing and Citing
 
Chapter 2 paraphrasing
Chapter 2 paraphrasingChapter 2 paraphrasing
Chapter 2 paraphrasing
 

Último

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Último (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 

Introduction to Javascript

  • 1. Chapter 4 Introduction to Javascript Internet Programming (TAB1033) mnibrahim@gmail.com
  • 2. Objectives By the end of this lecture, students will be able to: ► grasp the basic concepts of javascript and DOM ► describe the Client-Server Model ► differentiate between client-side scripting and server-side scripting ► develop a simple javascript that involves simple arithmetic operations 2 of 15
  • 3. Agenda ► Javascript is NOT Java programming language ► What is javascript? ► Why learn javascript? ► Client- Server Model ► Where Javascript Can Be Located? ► Processing User Input, DOM. ► e.g @the cashier ► References 3 of 15
  • 4. Javascript is NOT Java Java ► developed by SUN ► a powerful OO programming language . ► involved compiling java code into executable applications. ► Java programs created for use in a web page is called APPLET. javascript ► Designed by Netscape ► A powerful OO scripting language ► Need an interpreter (Browser dependent) ► To enhance the interactivity of web pages 4 of 15
  • 5. What is Javascript? ► JavaScript is a scripting languages (lightweight) ► It is usually embedded directly into an HTML doc ► Is an interpreted language – browser dependent ► JavaScript provides a programming language that allows pages to escape from being static marked- up information. – dynamic & interactive ► JavaScript is used in millions of Web pages to add functionality, validate forms, detect browsers, and much more. It is free!!! ► Pages that think. 5 of 15
  • 6. Why learn JavaScript? ► JavaScript gives HTML designers a programming tool - HTML authors are normally not programmers, but JavaScript is a scripting language with a very simple syntax! Almost anyone can put small "snippets" of code into their HTML pages ► JavaScript can put dynamic text into an HTML page - A JavaScript statement like this: document.write("<h1>" + name + "</h1>") can write a variable text into an HTML page 6 of 15
  • 7. …Why learn JavaScript? ► JavaScript can react to events - A JavaScript can be set to execute when something happens, like when a page has finished loading or when a user clicks on an HTML element ► JavaScript can read and write HTML elements - A JavaScript can read and change the content of an HTML element ► JavaScript can be used to validate data - A JavaScript can be used to validate form data before it is submitted to a server. 7 of 15
  • 8. …Why learn JavaScript? ► JavaScript can be used to detect the visitor's browser - A JavaScript can be used to detect the visitor's browser, and - depending on the browser - load another page specifically designed for that browser ► JavaScript can be used to create cookies - A JavaScript can be used to store and retrieve information on the visitor's computer 8 of 15
  • 9. The Client-Server Model Client Side Scripting 9 of 15
  • 10. ...The Client-Server Model Server Side Scripting 10 of 15
  • 11. Where Javascript Can Be Located? 1. In the <body> section  eg_js_01_body.html 2. In the <head> section  eg_js_01_head.html 3. As an external file  eg_js_01_external.html 11 of 15
  • 12. Processing User Input ► Javascript uses XHTML Documents Object Model (DOM) to process user input ► View a list of available objects http://www.w3schools.com/js/js_obj_htmldom.asp ► javascript event reference http://www.w3schools.com/jsref/jsref_events.asp ► Click eg_js_02.html to view an example of DOM and onchange() event. ► eg_js_01.html example of event, onclick(). 12 of 15
  • 13. Arithmetic Operator Operator Description Example Result + Addition z = 5 + 4; z = 9 - Subtraction z = 5 – 4; z = 1 * Multiplication z = 5 * 4; z = 20 / Division z = 5 / 4; z = 1.25 % Modulus (remainder) z = 5 % 4; z = 1 ++ Increment z = 1; y = ++z; y = 2 -- Decrement z = 1; y = --z; y = 0 13 of 15
  • 14. Simple Application @the Cashier ► A working example. eg_cashier_js.html 14 of 15