JavaScript Introduction and Background. 2 Web languages Three formal languages HTML JavaScript CSS Three different tasks Document description Client-side.

Slides:



Advertisements
Similar presentations
PHP I.
Advertisements

HTML 5 and CSS 3, Illustrated Complete Unit L: Programming Web Pages with JavaScript.
The Web Warrior Guide to Web Design Technologies
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic JavaScript: Introduction to Scripting.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
Tutorial 10 Programming with JavaScript
Information Technology Center Hany Abdelwahab Computer Specialist.
Javascript II Expressions and Data Types. 2 JavaScript Review programs executed by the web browser programs embedded in a web page using the script element.
XP Tutorial 1 New Perspectives on JavaScript, Comprehensive1 Introducing JavaScript Hiding Addresses from Spammers.
Introduction to JavaScript for Python Programmers
Introduction to JavaScript. Aim To enable you to write you first JavaScript.
Introduction to scripting
Javascript and the Web Whys and Hows of Javascript.
JavaScript Teppo Räisänen LIIKE/OAMK HTML, CSS, JavaScript HTML defines the structure CSS defines the layout JavaScript is used for scripting It.
JavaScript, Fifth Edition Chapter 1 Introduction to JavaScript.
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
CSC 330 E-Commerce Teacher Ahmed Mumtaz Mustehsan Ahmed Mumtaz Mustehsan GM-IT CIIT Islamabad GM-IT CIIT Islamabad CIIT Virtual Campus, CIIT COMSATS Institute.
SEG3210 DHTML Tutorial. DHTML DHTML is a combination of technologies used to create dynamic and interactive Web sites. –HTML - For creating text and image.
Section 17.1 Add an audio file using HTML Create a form using HTML Add text boxes using HTML Add radio buttons and check boxes using HTML Add a pull-down.
Chapter 4 JavaScript and Dynamic Web pages. Objectives Static Web pages Dynamic Web pages JavaScript Variables Assignments. JavaScript Functions –(prompt(“”,””)
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
JavaScript Professor Robin Burke. 2 Outline Quiz Tables JavaScript.
CMPS 211 JavaScript Topic 1 JavaScript Syntax. 2Outline Goals and Objectives Goals and Objectives Chapter Headlines Chapter Headlines Introduction Introduction.
1 JavaScript in Context. Server-Side Programming.
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
Tutorial 10 Programming with JavaScript. XP Objectives Learn the history of JavaScript Create a script element Understand basic JavaScript syntax Write.
Tutorial 10 Programming with JavaScript
Done by: Hanadi Muhsen1 Tutorial 1.  Learn the history of JavaScript  Create a script element  Write text to a Web page with JavaScript  Understand.
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
Dynamic Web Pages & JavaScript. Dynamic Web Pages Dynamic = Change Dynamic Web Pages are web pages that change. More than just moving graphics around.
20-753: Fundamentals of Web Programming 1 Lecture 12: Javascript I Fundamentals of Web Programming Lecture 12: Introduction to Javascript.
JavaScript - A Web Script Language Fred Durao
ALBERT WAVERING BOBBY SENG. Week 4: JavaScript  Quiz  Announcements/questions.
Dr. Qusai Abuein1 Internet & WWW How to program Chap.(6) JavaScript:Introduction to Scripting.
Introduction to JavaScript CS101 Introduction to Computing.
ECA 225 Applied Interactive Programming1 ECA 225 Applied Online Programming basics.
Chapter 2: Variables, Functions, Objects, and Events JavaScript - Introductory.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
4. Javascript M. Udin Harun Al Rasyid, S.Kom, Ph.D Lab Jaringan Komputer (C-307) Desain.
CSD 340 (Blum)1 Starting JavaScript Homage to the Homage to the Square.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
HTML Overview Part 5 – JavaScript 1. Scripts 2  Scripts are used to add dynamic content to a web page.  Scripts consist of a list of commands that execute.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
Understanding JavaScript and Coding Essentials Lesson 8.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
Project 5: Customizing User Content Essentials for Design JavaScript Level Two Michael Brooks.
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
Introduction to JavaScript MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 2/2/2016.
JavaScript 101 Lesson 6: Introduction to Functions.
REEM ALMOTIRI Information Technology Department Majmaah University.
JavaScript and AJAX 2nd Edition Tutorial 1 Programming with JavaScript.
Web Programming Java Script-Introduction. What is Javascript? JavaScript is a scripting language using for the Web. JavaScript is a programming language.
JavaScript Invented 1995 Steve, Tony & Sharon. A Scripting Language (A scripting language is a lightweight programming language that supports the writing.
Introduction to.
Chapter 6 JavaScript: Introduction to Scripting
Tutorial 10 Programming with JavaScript
Section 17.1 Section 17.2 Add an audio file using HTML
Introduction to Scripting
4. Javascript Pemrograman Web I Program Studi Teknik Informatika
JavaScript Introduction
JavaScript an introduction.
WEB PROGRAMMING JavaScript.
Tutorial 10: Programming with javascript
JavaScript: Introduction to Scripting
Web Programming and Design
Intro to Programming (in JavaScript)
Presentation transcript:

JavaScript Introduction and Background

2 Web languages Three formal languages HTML JavaScript CSS Three different tasks Document description Client-side interaction Style definition

3 Client-side interaction Example

4 Without JavaScript Browser can only display what the server sent each effect requires server round-trip too slow Client-side programming lets the browser handle user interaction makes web pages "dynamic"

5 For our purposes JavaScript is a reasonable first language Loosely typed Fewer details at first Interpreted Simple execution model Integrated with HTML Program files are just web pages Execution platform = browser No special tools to acquire

6 Programming HTML adds markup to text text is still there JavaScript little "content" beyond the program more abstract

7 Reading a program greet.html example What to see statements path of execution resources of the language function calls objects & properties user-defined and user-named items variables functions

8 Writing a program Design+construction process Meaning Start with requirements Plan the structure of the solution Implement the solution with available tools Making design decisions along the way Often evolutionary initial prototype improved upon until requirements met

9 In HTML Requirements some content text / images / links some organization for that content Plan sketching page layout Implement write HTML elements corresponding to layout design decisions layouts, style options Evolution view page in browser revise HTML

10 In JavaScript Requirements functional something we want the program to do Plan develop algorithm sequence of steps that will achieve the function Implement write each step of algorithm in formal language design decisions names, language elements Evolution debugging

11 Algorithm Steps to accomplish result In "greet.html" ask user for name print name and greeting on page

12 JavaScript skeleton... HTML head content... <!—... code here executed on loading... //-->... page content... <!--... code here executed during page rendering... //-->... more page content...

13 JavaScript execution model Interpreted Code is executed as read Outside of SCRIPT elements HTML output as usual Inside SCRIPT elements JavaScript evaluated May or may not result in output to the page At the end of the page JavaScript program terminates but code may still be resident event handling

14 Debugging Defects in programs can difficult to find error messages from browser can very unhelpful If you even see any! the computer doesn't "understand" your program programs are "brittle" Can be frustrating

15 Debugging tools Make sure to make errors visible browser settings Test your assumptions sometimes useful to print out values during computation Figure out exactly where the error occurs might not be where you think Reproduce the error in a simplified program sometimes your expectations are wrong

16 Variables An algorithm will have multiple steps Steps are linked by values value computed in step 1 used in step 2 Necessary to store computed values Variables names given to stored values firstName Reserved Keywords Can’t be used as variable names See Page 63

17 JavaScript language Syntax how statements are constructed Semantics what statements mean Operations what computations you can perform

18 Syntax statement ends in ; assignment statement variable = value; function call function name (parameters) "" delimits a list of characters as a string

19 Semantics assignment places a value in a named location function call invokes a named function with the given parameters may return a value

20 Prompt function prompt (promptValue, defaultValue) Effect opens a prompt dialog for user input Input prompt to be displayed initial value in text input area Result user's input string

21 document.write function document.write (text) Ignore the funny syntax for now Effect Writes text to the web page Input Text to output Result none

22 + operator Combines strings together string1 + string2 Input two string values Output single string value concatenated