SlideShare a Scribd company logo
SFDV2001 – Web Development Lecture  3: JavaScript
History – Mechanical Programs Charles Babbage Developed the first mechanical computation. Created the Difference Engine. Designed the Analytical Engine. Ada Byron, Lady Lovelace Described the uses of the Analytical Engine. Helped create the first computer program. 11/09/07 (SFDV2001:15)JavaScript
History - Computability Alan Turing Defined the set of all things that  could be computed. Studied computability. Tests for Artificial Intelligence. War hero Worked at Bletchley Park. Headed the group working on breaking the Enigma. Developed electronic machines to break codes. 11/09/07 (SFDV2001:15)JavaScript
History – Modern Computers John von Neumann Mathematician and Physicist. Worked on the H-bomb. Contributed to many areas. Computer Design Processing unit. Memory. Input and output. 11/09/07 (SFDV2001:15)JavaScript
Computer Design Central processing unit (CPU) ‏ A central core that processes instructions . Increments a program counter. Has small internal storage. Memory (RAM) ‏ An area to hold programs and data. Accessible from the CPU. An address for every location. Bus connects CPU to memory. 11/09/07 (SFDV2001:15)JavaScript
Computer Design Input Punch cards and switches. Keyboards, mouse, camera,... Scanners. GSR Galvanic Skin Response. nMRI. Output Flashing lights, cards. Screens, printers, speakers,...  Computer Aided Machining.  11/09/07 (SFDV2001:15)JavaScript
Programming Writing programs for computing devices Remember Sequence  Selection Repetition Central Processing Unit runs these instructions. Memory holds data. Input allows interaction. Output lets us see what is going on. 11/09/07 (SFDV2001:15)JavaScript
Scripting A script is a list of stuff to do. Works through a application that interprets the “script”. Scripting ability added to Netscape v2.0 Initially mocha then LiveScript. Simple instructions. New commands added over time. 11/09/07 (SFDV2001:15)JavaScript
JavaScript JavaScript is NOT JAVA Similarity  both used on the web. similar syntax, based on C. Objects are important. Not a universal standard Ecma standard script is similar. IE implements similar script called JScript. Different bowsers different behaviour. 11/09/07 (SFDV2001:15)JavaScript C Java JavaScript
JavaScript Provides tools for: Mouse over events Checking Navigation Changing display Uses include: Allows developer to do more than HTML Making pages responsive to the user Much of the early uses superseded by CSS 11/09/07 (SFDV2001:15)JavaScript
Including JavaScript Script tag <script type=”....”>  </script> HTML comment <!-- so old browsers do not try to interpret it JavaScript comment // before the  --> so JavaScript does not try to interpret that bit 11/09/07 (SFDV2001:15)JavaScript <script type=”text/javascript”> <!-- javascript code //--> </script>
Commenting HTML comments  <!--  --> JavaScript comments  /*  */   to end of line // Allows the developer to make notes and clarify issues. Common comments include Author  Dates and  versions  Problems and bugs Explanation of complex processes 11/09/07 (SFDV2001:15)JavaScript
Variables A name for an object var age = 31 Can be numbers  31 text “simon” boolean true/false null Example x = 5, y = 3 document.writeln(x + y); outputs 8 11/09/07 (SFDV2001:15)JavaScript
Functions and Methods A block of instructions that are collected together. Allows reuse of code. Makes things easier to read. Examples document. write (“Hello World”); Date (); Math. sqrt (25); A method is a function attached to an object. 11/09/07 (SFDV2001:15)JavaScript
Parameters Variables or values passed to functions. document.writeln( “string” ) ‏ passed the string to write. window.open( “url”, “name”, “features” ) ‏ passed stings for: url,  name features of the window Math.sqrt( number ) ‏ passed the number to square root. 11/09/07 (SFDV2001:15)JavaScript
Examples MouseOver effects Usually changing an image Can do other things, like popups CSS is better for mouse overs that just change images. 11/09/07 (SFDV2001:15)JavaScript <img align=right src=&quot;cosc_logo.jpg&quot;  onMouseOver = this.src=&quot;unilogo.gif&quot; onMouseOut  = this.src=&quot;cslogo.jpg&quot;> <img align=right src=&quot;cosc_logo.jpg&quot;  onMouseOver = this.src=&quot;unilogo.gif&quot; onMouseOut  = this.src=&quot;cslogo.jpg&quot;> <img align=right src=&quot;cosc_logo.jpg&quot;  onMouseOver = window.open(“http://www.otago.ac.nz”)> Change to local examples
Examples Popups Those irritating new windows Blocked by lots of browsers and browser extensions Last string for features such as toolbar, location, directories, status, menubar,.... width=pixels height=pixels Please don't use popups  11/09/07 (SFDV2001:15)JavaScript window.open(“http://www.otago.ac.nz”,”otago”,””) ‏ window.open(“”,”otago”,”width=40,height=40”) ‏
Examples Form validation Good use of JavaScript. Checks: numbers are numbers dates are valid  all data has been entered Gives feedback about selected items More about this next week 11/09/07 (SFDV2001:15)JavaScript
Event Driven Programming Responding to things like Mouse Clicks Keystrokes Windows opening Program termination JavaScript responds to events rather than polling. Polling – Are we there yet?, Are we there yet?, Are we there yet? Are.......... Event – Car stopping - “Are we there?” 11/09/07 (SFDV2001:15)JavaScript
Next The DOM and JavaScript. More examples of JavaScript. Objects. Form validation. Problems with JavaScript. 11/09/07 (SFDV2001:15)JavaScript

More Related Content

PDF
WordCamp ABQ 2013: Making the leap from Designer to Designer/Developer
PDF
Wordcamp abq cf-cpt
PPT
Lecture 6 Data Driven Design
PPT
WordPress development paradigms, idiosyncrasies and other big words
PDF
Building mobile applications with DrupalGap
PDF
Intro to mobile web application development
PPTX
Css, xhtml, javascript
ODP
WordCamp ABQ 2013: Making the leap from Designer to Designer/Developer
Wordcamp abq cf-cpt
Lecture 6 Data Driven Design
WordPress development paradigms, idiosyncrasies and other big words
Building mobile applications with DrupalGap
Intro to mobile web application development
Css, xhtml, javascript

What's hot (20)

PPT
Lecture 9 Professional Practices
PDF
Taiwan Web Standards Talk 2011
KEY
Intro to html5 Boilerplate
ZIP
Looking into HTML5
PDF
HTML 5 Step By Step - Ebook
PPT
Eugene Andruszczenko: jQuery
PDF
Web Development for UX Designers
KEY
An Introduction to HTML5
PPT
WordPress Development Confoo 2010
PDF
Fewd week4 slides
PDF
HTML5 & Friends
PPTX
JavaScript Presentation Frameworks and Libraries
ODP
Ant User Guide
PPT
Lecture1 B Frames&Forms
PPT
HTML 5 Overview
PDF
HTML5: features with examples
PPTX
Html 5 tutorial - By Bally Chohan
PDF
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
PPTX
Cartegraph Live HTML, CSS, JavaScript and jQuery Training
Lecture 9 Professional Practices
Taiwan Web Standards Talk 2011
Intro to html5 Boilerplate
Looking into HTML5
HTML 5 Step By Step - Ebook
Eugene Andruszczenko: jQuery
Web Development for UX Designers
An Introduction to HTML5
WordPress Development Confoo 2010
Fewd week4 slides
HTML5 & Friends
JavaScript Presentation Frameworks and Libraries
Ant User Guide
Lecture1 B Frames&Forms
HTML 5 Overview
HTML5: features with examples
Html 5 tutorial - By Bally Chohan
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Cartegraph Live HTML, CSS, JavaScript and jQuery Training
Ad

Viewers also liked (11)

PPT
Lecture 5 - Comm Lab: Web @ ITP
PPT
WordPress made for humans
PDF
2/2 slave labor on farms
PDF
JavaScript introduction 1 ( Variables And Values )
PPT
eXo SEA - JavaScript Introduction Training
PPT
introduction to javascript
PDF
JavaScript Basics And DOM Manipulation
KEY
Introduction to Javascript - College Lecture
PPT
Introduction to JavaScript
PPT
Introduction to Javascript
PPT
JavaScript - An Introduction
Lecture 5 - Comm Lab: Web @ ITP
WordPress made for humans
2/2 slave labor on farms
JavaScript introduction 1 ( Variables And Values )
eXo SEA - JavaScript Introduction Training
introduction to javascript
JavaScript Basics And DOM Manipulation
Introduction to Javascript - College Lecture
Introduction to JavaScript
Introduction to Javascript
JavaScript - An Introduction
Ad

Similar to Lecture 3 Javascript1 (20)

PPTX
Java script introduction
PPTX
JAVASRIPT and PHP Basics# Unit 2 Webdesign
PPTX
Java script
PDF
GDI Seattle - Intro to JavaScript Class 1
PDF
Training javascript 2012 hcmut
PPTX
Java script
PPTX
JavaScript as Development Platform
PPT
Html JavaScript and CSS
PPT
Abusing JavaScript for fun and profit
PPTX
JavaScript | Introduction
DOC
Basics java scripts
PPTX
Web Technology Part 2
PPT
INTRO TO JAVASCRIPT basic to adcance.ppt
PDF
Thinkful - Intro to JavaScript
DOC
javscript
PPTX
CSC PPT 12.pptx
PPT
JavaScript Workshop
PPTX
Java Script basics and DOM
PDF
Splash
PPT
Java script
Java script introduction
JAVASRIPT and PHP Basics# Unit 2 Webdesign
Java script
GDI Seattle - Intro to JavaScript Class 1
Training javascript 2012 hcmut
Java script
JavaScript as Development Platform
Html JavaScript and CSS
Abusing JavaScript for fun and profit
JavaScript | Introduction
Basics java scripts
Web Technology Part 2
INTRO TO JAVASCRIPT basic to adcance.ppt
Thinkful - Intro to JavaScript
javscript
CSC PPT 12.pptx
JavaScript Workshop
Java Script basics and DOM
Splash
Java script

More from Sur College of Applied Sciences (11)

PPT
PPT
Lecture 11 B Security
PPT
Lecture 10 Image Format
PPT
Lecture 9 Usability Orignal
PPT
Lecture 9 Accessibility Original
PPT
Accessibility Usability Professional Summry
Lecture 11 B Security
Lecture 10 Image Format
Lecture 9 Usability Orignal
Lecture 9 Accessibility Original
Accessibility Usability Professional Summry

Recently uploaded (20)

PPTX
Institutional Correction lecture only . . .
PDF
Basic Mud Logging Guide for educational purpose
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
01-Introduction-to-Information-Management.pdf
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
Pharma ospi slides which help in ospi learning
PPTX
Cell Structure & Organelles in detailed.
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
Pre independence Education in Inndia.pdf
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
VCE English Exam - Section C Student Revision Booklet
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
Institutional Correction lecture only . . .
Basic Mud Logging Guide for educational purpose
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
01-Introduction-to-Information-Management.pdf
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Pharma ospi slides which help in ospi learning
Cell Structure & Organelles in detailed.
Microbial diseases, their pathogenesis and prophylaxis
Pre independence Education in Inndia.pdf
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
VCE English Exam - Section C Student Revision Booklet
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
O5-L3 Freight Transport Ops (International) V1.pdf
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Renaissance Architecture: A Journey from Faith to Humanism

Lecture 3 Javascript1

  • 1. SFDV2001 – Web Development Lecture 3: JavaScript
  • 2. History – Mechanical Programs Charles Babbage Developed the first mechanical computation. Created the Difference Engine. Designed the Analytical Engine. Ada Byron, Lady Lovelace Described the uses of the Analytical Engine. Helped create the first computer program. 11/09/07 (SFDV2001:15)JavaScript
  • 3. History - Computability Alan Turing Defined the set of all things that could be computed. Studied computability. Tests for Artificial Intelligence. War hero Worked at Bletchley Park. Headed the group working on breaking the Enigma. Developed electronic machines to break codes. 11/09/07 (SFDV2001:15)JavaScript
  • 4. History – Modern Computers John von Neumann Mathematician and Physicist. Worked on the H-bomb. Contributed to many areas. Computer Design Processing unit. Memory. Input and output. 11/09/07 (SFDV2001:15)JavaScript
  • 5. Computer Design Central processing unit (CPU) ‏ A central core that processes instructions . Increments a program counter. Has small internal storage. Memory (RAM) ‏ An area to hold programs and data. Accessible from the CPU. An address for every location. Bus connects CPU to memory. 11/09/07 (SFDV2001:15)JavaScript
  • 6. Computer Design Input Punch cards and switches. Keyboards, mouse, camera,... Scanners. GSR Galvanic Skin Response. nMRI. Output Flashing lights, cards. Screens, printers, speakers,... Computer Aided Machining. 11/09/07 (SFDV2001:15)JavaScript
  • 7. Programming Writing programs for computing devices Remember Sequence Selection Repetition Central Processing Unit runs these instructions. Memory holds data. Input allows interaction. Output lets us see what is going on. 11/09/07 (SFDV2001:15)JavaScript
  • 8. Scripting A script is a list of stuff to do. Works through a application that interprets the “script”. Scripting ability added to Netscape v2.0 Initially mocha then LiveScript. Simple instructions. New commands added over time. 11/09/07 (SFDV2001:15)JavaScript
  • 9. JavaScript JavaScript is NOT JAVA Similarity both used on the web. similar syntax, based on C. Objects are important. Not a universal standard Ecma standard script is similar. IE implements similar script called JScript. Different bowsers different behaviour. 11/09/07 (SFDV2001:15)JavaScript C Java JavaScript
  • 10. JavaScript Provides tools for: Mouse over events Checking Navigation Changing display Uses include: Allows developer to do more than HTML Making pages responsive to the user Much of the early uses superseded by CSS 11/09/07 (SFDV2001:15)JavaScript
  • 11. Including JavaScript Script tag <script type=”....”> </script> HTML comment <!-- so old browsers do not try to interpret it JavaScript comment // before the --> so JavaScript does not try to interpret that bit 11/09/07 (SFDV2001:15)JavaScript <script type=”text/javascript”> <!-- javascript code //--> </script>
  • 12. Commenting HTML comments <!-- --> JavaScript comments /* */ to end of line // Allows the developer to make notes and clarify issues. Common comments include Author Dates and versions Problems and bugs Explanation of complex processes 11/09/07 (SFDV2001:15)JavaScript
  • 13. Variables A name for an object var age = 31 Can be numbers 31 text “simon” boolean true/false null Example x = 5, y = 3 document.writeln(x + y); outputs 8 11/09/07 (SFDV2001:15)JavaScript
  • 14. Functions and Methods A block of instructions that are collected together. Allows reuse of code. Makes things easier to read. Examples document. write (“Hello World”); Date (); Math. sqrt (25); A method is a function attached to an object. 11/09/07 (SFDV2001:15)JavaScript
  • 15. Parameters Variables or values passed to functions. document.writeln( “string” ) ‏ passed the string to write. window.open( “url”, “name”, “features” ) ‏ passed stings for: url, name features of the window Math.sqrt( number ) ‏ passed the number to square root. 11/09/07 (SFDV2001:15)JavaScript
  • 16. Examples MouseOver effects Usually changing an image Can do other things, like popups CSS is better for mouse overs that just change images. 11/09/07 (SFDV2001:15)JavaScript <img align=right src=&quot;cosc_logo.jpg&quot; onMouseOver = this.src=&quot;unilogo.gif&quot; onMouseOut = this.src=&quot;cslogo.jpg&quot;> <img align=right src=&quot;cosc_logo.jpg&quot; onMouseOver = this.src=&quot;unilogo.gif&quot; onMouseOut = this.src=&quot;cslogo.jpg&quot;> <img align=right src=&quot;cosc_logo.jpg&quot; onMouseOver = window.open(“http://www.otago.ac.nz”)> Change to local examples
  • 17. Examples Popups Those irritating new windows Blocked by lots of browsers and browser extensions Last string for features such as toolbar, location, directories, status, menubar,.... width=pixels height=pixels Please don't use popups 11/09/07 (SFDV2001:15)JavaScript window.open(“http://www.otago.ac.nz”,”otago”,””) ‏ window.open(“”,”otago”,”width=40,height=40”) ‏
  • 18. Examples Form validation Good use of JavaScript. Checks: numbers are numbers dates are valid all data has been entered Gives feedback about selected items More about this next week 11/09/07 (SFDV2001:15)JavaScript
  • 19. Event Driven Programming Responding to things like Mouse Clicks Keystrokes Windows opening Program termination JavaScript responds to events rather than polling. Polling – Are we there yet?, Are we there yet?, Are we there yet? Are.......... Event – Car stopping - “Are we there?” 11/09/07 (SFDV2001:15)JavaScript
  • 20. Next The DOM and JavaScript. More examples of JavaScript. Objects. Form validation. Problems with JavaScript. 11/09/07 (SFDV2001:15)JavaScript

Editor's Notes

  • #17: Change to local examples