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
Ad

Recommended

WordCamp ABQ 2013: Making the leap from Designer to Designer/Developer
WordCamp ABQ 2013: Making the leap from Designer to Designer/Developer
my easel
 
Wordcamp abq cf-cpt
Wordcamp abq cf-cpt
my easel
 
Lecture 6 Data Driven Design
Lecture 6 Data Driven Design
Sur College of Applied Sciences
 
WordPress development paradigms, idiosyncrasies and other big words
WordPress development paradigms, idiosyncrasies and other big words
TomAuger
 
Building mobile applications with DrupalGap
Building mobile applications with DrupalGap
Alex S
 
Intro to mobile web application development
Intro to mobile web application development
zonathen
 
Css, xhtml, javascript
Css, xhtml, javascript
Trần Khải Hoàng
 
HTML5
HTML5
Hatem Mahmoud
 
Lecture 9 Professional Practices
Lecture 9 Professional Practices
Sur College of Applied Sciences
 
Taiwan Web Standards Talk 2011
Taiwan Web Standards Talk 2011
Zi Bin Cheah
 
Intro to html5 Boilerplate
Intro to html5 Boilerplate
Michael Enslow
 
Looking into HTML5
Looking into HTML5
Christopher Schmitt
 
HTML 5 Step By Step - Ebook
HTML 5 Step By Step - Ebook
Scottperrone
 
Eugene Andruszczenko: jQuery
Eugene Andruszczenko: jQuery
Refresh Events
 
Web Development for UX Designers
Web Development for UX Designers
Ashlimarie
 
An Introduction to HTML5
An Introduction to HTML5
Steven Chipman
 
WordPress Development Confoo 2010
WordPress Development Confoo 2010
Brendan Sera-Shriar
 
Fewd week4 slides
Fewd week4 slides
William Myers
 
HTML5 & Friends
HTML5 & Friends
Remy Sharp
 
Lecture2 CSS 2
Lecture2 CSS 2
Sur College of Applied Sciences
 
JavaScript Presentation Frameworks and Libraries
JavaScript Presentation Frameworks and Libraries
Oleksii Prohonnyi
 
Ant User Guide
Ant User Guide
Muthuselvam RS
 
Lecture1 B Frames&Forms
Lecture1 B Frames&Forms
Sur College of Applied Sciences
 
HTML 5 Overview
HTML 5 Overview
Offir Ariel
 
HTML5: features with examples
HTML5: features with examples
Alfredo Torre
 
Html 5 tutorial - By Bally Chohan
Html 5 tutorial - By Bally Chohan
ballychohanuk
 
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Sean Burgess
 
Cartegraph Live HTML, CSS, JavaScript and jQuery Training
Cartegraph Live HTML, CSS, JavaScript and jQuery Training
Shane Church
 
Lecture 5 - Comm Lab: Web @ ITP
Lecture 5 - Comm Lab: Web @ ITP
yucefmerhi
 
WordPress made for humans
WordPress made for humans
Stefanos Kofopoulos
 

More Related Content

What's hot (20)

Lecture 9 Professional Practices
Lecture 9 Professional Practices
Sur College of Applied Sciences
 
Taiwan Web Standards Talk 2011
Taiwan Web Standards Talk 2011
Zi Bin Cheah
 
Intro to html5 Boilerplate
Intro to html5 Boilerplate
Michael Enslow
 
Looking into HTML5
Looking into HTML5
Christopher Schmitt
 
HTML 5 Step By Step - Ebook
HTML 5 Step By Step - Ebook
Scottperrone
 
Eugene Andruszczenko: jQuery
Eugene Andruszczenko: jQuery
Refresh Events
 
Web Development for UX Designers
Web Development for UX Designers
Ashlimarie
 
An Introduction to HTML5
An Introduction to HTML5
Steven Chipman
 
WordPress Development Confoo 2010
WordPress Development Confoo 2010
Brendan Sera-Shriar
 
Fewd week4 slides
Fewd week4 slides
William Myers
 
HTML5 & Friends
HTML5 & Friends
Remy Sharp
 
Lecture2 CSS 2
Lecture2 CSS 2
Sur College of Applied Sciences
 
JavaScript Presentation Frameworks and Libraries
JavaScript Presentation Frameworks and Libraries
Oleksii Prohonnyi
 
Ant User Guide
Ant User Guide
Muthuselvam RS
 
Lecture1 B Frames&Forms
Lecture1 B Frames&Forms
Sur College of Applied Sciences
 
HTML 5 Overview
HTML 5 Overview
Offir Ariel
 
HTML5: features with examples
HTML5: features with examples
Alfredo Torre
 
Html 5 tutorial - By Bally Chohan
Html 5 tutorial - By Bally Chohan
ballychohanuk
 
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Sean Burgess
 
Cartegraph Live HTML, CSS, JavaScript and jQuery Training
Cartegraph Live HTML, CSS, JavaScript and jQuery Training
Shane Church
 
Taiwan Web Standards Talk 2011
Taiwan Web Standards Talk 2011
Zi Bin Cheah
 
Intro to html5 Boilerplate
Intro to html5 Boilerplate
Michael Enslow
 
HTML 5 Step By Step - Ebook
HTML 5 Step By Step - Ebook
Scottperrone
 
Eugene Andruszczenko: jQuery
Eugene Andruszczenko: jQuery
Refresh Events
 
Web Development for UX Designers
Web Development for UX Designers
Ashlimarie
 
An Introduction to HTML5
An Introduction to HTML5
Steven Chipman
 
WordPress Development Confoo 2010
WordPress Development Confoo 2010
Brendan Sera-Shriar
 
HTML5 & Friends
HTML5 & Friends
Remy Sharp
 
JavaScript Presentation Frameworks and Libraries
JavaScript Presentation Frameworks and Libraries
Oleksii Prohonnyi
 
HTML5: features with examples
HTML5: features with examples
Alfredo Torre
 
Html 5 tutorial - By Bally Chohan
Html 5 tutorial - By Bally Chohan
ballychohanuk
 
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Sean Burgess
 
Cartegraph Live HTML, CSS, JavaScript and jQuery Training
Cartegraph Live HTML, CSS, JavaScript and jQuery Training
Shane Church
 

Viewers also liked (11)

Lecture 5 - Comm Lab: Web @ ITP
Lecture 5 - Comm Lab: Web @ ITP
yucefmerhi
 
WordPress made for humans
WordPress made for humans
Stefanos Kofopoulos
 
2/2 slave labor on farms
2/2 slave labor on farms
StopTrafficking
 
JavaScript introduction 1 ( Variables And Values )
JavaScript introduction 1 ( Variables And Values )
Victor Verhaagen
 
eXo SEA - JavaScript Introduction Training
eXo SEA - JavaScript Introduction Training
Hoat Le
 
introduction to javascript
introduction to javascript
Kumar
 
JavaScript Basics And DOM Manipulation
JavaScript Basics And DOM Manipulation
Siarhei Barysiuk
 
Introduction to Javascript - College Lecture
Introduction to Javascript - College Lecture
Zac Gordon
 
Introduction to JavaScript
Introduction to JavaScript
Andres Baravalle
 
Introduction to Javascript
Introduction to Javascript
Amit Tyagi
 
JavaScript - An Introduction
JavaScript - An Introduction
Manvendra Singh
 
Lecture 5 - Comm Lab: Web @ ITP
Lecture 5 - Comm Lab: Web @ ITP
yucefmerhi
 
2/2 slave labor on farms
2/2 slave labor on farms
StopTrafficking
 
JavaScript introduction 1 ( Variables And Values )
JavaScript introduction 1 ( Variables And Values )
Victor Verhaagen
 
eXo SEA - JavaScript Introduction Training
eXo SEA - JavaScript Introduction Training
Hoat Le
 
introduction to javascript
introduction to javascript
Kumar
 
JavaScript Basics And DOM Manipulation
JavaScript Basics And DOM Manipulation
Siarhei Barysiuk
 
Introduction to Javascript - College Lecture
Introduction to Javascript - College Lecture
Zac Gordon
 
Introduction to JavaScript
Introduction to JavaScript
Andres Baravalle
 
Introduction to Javascript
Introduction to Javascript
Amit Tyagi
 
JavaScript - An Introduction
JavaScript - An Introduction
Manvendra Singh
 
Ad

Similar to Lecture 3 Javascript1 (20)

Java script introduction
Java script introduction
Jesus Obenita Jr.
 
JAVASRIPT and PHP Basics# Unit 2 Webdesign
JAVASRIPT and PHP Basics# Unit 2 Webdesign
NitinShelake4
 
Java script
Java script
Sukrit Gupta
 
GDI Seattle - Intro to JavaScript Class 1
GDI Seattle - Intro to JavaScript Class 1
Heather Rock
 
Training javascript 2012 hcmut
Training javascript 2012 hcmut
University of Technology
 
Java script
Java script
Abhishek Kesharwani
 
JavaScript as Development Platform
JavaScript as Development Platform
Alexei Skachykhin
 
Html JavaScript and CSS
Html JavaScript and CSS
Radhe Krishna Rajan
 
Abusing JavaScript for fun and profit
Abusing JavaScript for fun and profit
Myles Eftos
 
JavaScript | Introduction
JavaScript | Introduction
Velimir Bulatovic
 
Basics java scripts
Basics java scripts
ch samaram
 
Web Technology Part 2
Web Technology Part 2
Thapar Institute
 
INTRO TO JAVASCRIPT basic to adcance.ppt
INTRO TO JAVASCRIPT basic to adcance.ppt
testvarun21
 
Thinkful - Intro to JavaScript
Thinkful - Intro to JavaScript
TJ Stalcup
 
javscript
javscript
rcc1964
 
CSC PPT 12.pptx
CSC PPT 12.pptx
DrRavneetSingh
 
JavaScript Workshop
JavaScript Workshop
Pamela Fox
 
Java Script basics and DOM
Java Script basics and DOM
Sukrit Gupta
 
Splash
Splash
Brendan Eich
 
Java script
Java script
Soham Sengupta
 
JAVASRIPT and PHP Basics# Unit 2 Webdesign
JAVASRIPT and PHP Basics# Unit 2 Webdesign
NitinShelake4
 
GDI Seattle - Intro to JavaScript Class 1
GDI Seattle - Intro to JavaScript Class 1
Heather Rock
 
JavaScript as Development Platform
JavaScript as Development Platform
Alexei Skachykhin
 
Abusing JavaScript for fun and profit
Abusing JavaScript for fun and profit
Myles Eftos
 
Basics java scripts
Basics java scripts
ch samaram
 
INTRO TO JAVASCRIPT basic to adcance.ppt
INTRO TO JAVASCRIPT basic to adcance.ppt
testvarun21
 
Thinkful - Intro to JavaScript
Thinkful - Intro to JavaScript
TJ Stalcup
 
javscript
javscript
rcc1964
 
JavaScript Workshop
JavaScript Workshop
Pamela Fox
 
Java Script basics and DOM
Java Script basics and DOM
Sukrit Gupta
 
Ad

More from Sur College of Applied Sciences (11)

Lecture11 A Image
Lecture11 A Image
Sur College of Applied Sciences
 
Lecture 11 B Security
Lecture 11 B Security
Sur College of Applied Sciences
 
Lecture 10 Image Format
Lecture 10 Image Format
Sur College of Applied Sciences
 
Lecture 9 Usability Orignal
Lecture 9 Usability Orignal
Sur College of Applied Sciences
 
Lecture 9 Accessibility Original
Lecture 9 Accessibility Original
Sur College of Applied Sciences
 
Accessibility Usability Professional Summry
Accessibility Usability Professional Summry
Sur College of Applied Sciences
 
Lecture 8 Video
Lecture 8 Video
Sur College of Applied Sciences
 
Lecture 5 XML
Lecture 5 XML
Sur College of Applied Sciences
 
Lecture2 CSS 3
Lecture2 CSS 3
Sur College of Applied Sciences
 
Lecture2 CSS1
Lecture2 CSS1
Sur College of Applied Sciences
 
Navigation1 A
Navigation1 A
Sur College of Applied Sciences
 

Recently uploaded (20)

English 3 Quarter 1_LEwithLAS_Week 1.pdf
English 3 Quarter 1_LEwithLAS_Week 1.pdf
DeAsisAlyanajaneH
 
Values Education 10 Quarter 1 Module .pptx
Values Education 10 Quarter 1 Module .pptx
JBPafin
 
GREAT QUIZ EXCHANGE 2025 - GENERAL QUIZ.pptx
GREAT QUIZ EXCHANGE 2025 - GENERAL QUIZ.pptx
Ronisha Das
 
ENGLISH-5 Q1 Lesson 1.pptx - Story Elements
ENGLISH-5 Q1 Lesson 1.pptx - Story Elements
Mayvel Nadal
 
Photo chemistry Power Point Presentation
Photo chemistry Power Point Presentation
mprpgcwa2024
 
How to Customize Quotation Layouts in Odoo 18
How to Customize Quotation Layouts in Odoo 18
Celine George
 
Aprendendo Arquitetura Framework Salesforce - Dia 02
Aprendendo Arquitetura Framework Salesforce - Dia 02
Mauricio Alexandre Silva
 
K12 Tableau User Group virtual event June 18, 2025
K12 Tableau User Group virtual event June 18, 2025
dogden2
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 6-14-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 6-14-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
Code Profiling in Odoo 18 - Odoo 18 Slides
Code Profiling in Odoo 18 - Odoo 18 Slides
Celine George
 
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Rajdeep Bavaliya
 
Hurricane Helene Application Documents Checklists
Hurricane Helene Application Documents Checklists
Mebane Rash
 
Intellectual Property Right (Jurisprudence).pptx
Intellectual Property Right (Jurisprudence).pptx
Vishal Chanalia
 
University of Ghana Cracks Down on Misconduct: Over 100 Students Sanctioned
University of Ghana Cracks Down on Misconduct: Over 100 Students Sanctioned
Kweku Zurek
 
Plate Tectonic Boundaries and Continental Drift Theory
Plate Tectonic Boundaries and Continental Drift Theory
Marie
 
2025 June Year 9 Presentation: Subject selection.pptx
2025 June Year 9 Presentation: Subject selection.pptx
mansk2
 
LDMMIA Yoga S10 Free Workshop Grad Level
LDMMIA Yoga S10 Free Workshop Grad Level
LDM & Mia eStudios
 
Birnagar High School Platinum Jubilee Quiz.pptx
Birnagar High School Platinum Jubilee Quiz.pptx
Sourav Kr Podder
 
SCHIZOPHRENIA OTHER PSYCHOTIC DISORDER LIKE Persistent delusion/Capgras syndr...
SCHIZOPHRENIA OTHER PSYCHOTIC DISORDER LIKE Persistent delusion/Capgras syndr...
parmarjuli1412
 
How to Manage Different Customer Addresses in Odoo 18 Accounting
How to Manage Different Customer Addresses in Odoo 18 Accounting
Celine George
 
English 3 Quarter 1_LEwithLAS_Week 1.pdf
English 3 Quarter 1_LEwithLAS_Week 1.pdf
DeAsisAlyanajaneH
 
Values Education 10 Quarter 1 Module .pptx
Values Education 10 Quarter 1 Module .pptx
JBPafin
 
GREAT QUIZ EXCHANGE 2025 - GENERAL QUIZ.pptx
GREAT QUIZ EXCHANGE 2025 - GENERAL QUIZ.pptx
Ronisha Das
 
ENGLISH-5 Q1 Lesson 1.pptx - Story Elements
ENGLISH-5 Q1 Lesson 1.pptx - Story Elements
Mayvel Nadal
 
Photo chemistry Power Point Presentation
Photo chemistry Power Point Presentation
mprpgcwa2024
 
How to Customize Quotation Layouts in Odoo 18
How to Customize Quotation Layouts in Odoo 18
Celine George
 
Aprendendo Arquitetura Framework Salesforce - Dia 02
Aprendendo Arquitetura Framework Salesforce - Dia 02
Mauricio Alexandre Silva
 
K12 Tableau User Group virtual event June 18, 2025
K12 Tableau User Group virtual event June 18, 2025
dogden2
 
Code Profiling in Odoo 18 - Odoo 18 Slides
Code Profiling in Odoo 18 - Odoo 18 Slides
Celine George
 
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Rajdeep Bavaliya
 
Hurricane Helene Application Documents Checklists
Hurricane Helene Application Documents Checklists
Mebane Rash
 
Intellectual Property Right (Jurisprudence).pptx
Intellectual Property Right (Jurisprudence).pptx
Vishal Chanalia
 
University of Ghana Cracks Down on Misconduct: Over 100 Students Sanctioned
University of Ghana Cracks Down on Misconduct: Over 100 Students Sanctioned
Kweku Zurek
 
Plate Tectonic Boundaries and Continental Drift Theory
Plate Tectonic Boundaries and Continental Drift Theory
Marie
 
2025 June Year 9 Presentation: Subject selection.pptx
2025 June Year 9 Presentation: Subject selection.pptx
mansk2
 
LDMMIA Yoga S10 Free Workshop Grad Level
LDMMIA Yoga S10 Free Workshop Grad Level
LDM & Mia eStudios
 
Birnagar High School Platinum Jubilee Quiz.pptx
Birnagar High School Platinum Jubilee Quiz.pptx
Sourav Kr Podder
 
SCHIZOPHRENIA OTHER PSYCHOTIC DISORDER LIKE Persistent delusion/Capgras syndr...
SCHIZOPHRENIA OTHER PSYCHOTIC DISORDER LIKE Persistent delusion/Capgras syndr...
parmarjuli1412
 
How to Manage Different Customer Addresses in Odoo 18 Accounting
How to Manage Different Customer Addresses in Odoo 18 Accounting
Celine George
 

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