 2003 Prentice Hall, Inc. All rights reserved. Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing.

Slides:



Advertisements
Similar presentations
Chapter 7 JavaScript: Introduction to Scripting. Outline Simple Programs Objects and Variables Obtaining User Input with prompt Dialogs – –Dynamic Welcome.
Advertisements

 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing.
Lecture 2 Introduction to C Programming
Introduction to C Programming
 2005 Pearson Education, Inc. All rights reserved Introduction.
 2000 Prentice Hall, Inc. All rights reserved. Chapter 2 - Introduction to C Programming Outline 2.1Introduction 2.2A Simple C Program: Printing a Line.
Introduction to C Programming
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic JavaScript: Introduction to Scripting.
1 Outline 13.1Introduction 13.2A Simple Program: Printing a Line of Text in a Web Page 13.3Another JavaScript Program: Adding Integers 13.4Memory Concepts.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
 2007 Pearson Education, Inc. All rights reserved Introduction to C Programming.
 2002 Prentice Hall. All rights reserved. 1 Chapter 2 – Introduction to Python Programming Outline 2.1 Introduction 2.2 First Program in Python: Printing.
Introduction to C Programming
Introduction to scripting
JavaScript: Control Structures September 27, 2005 Slides modified from Internet & World Wide Web: How to Program (3rd) edition. By Deitel, Deitel,
 2003 Prentice Hall, Inc. All rights reserved. 1 Introduction to C++ Programming Outline Introduction to C++ Programming A Simple Program: Printing a.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing.
WEB DESIGN AND PROGRAMMING Introduction to Javascript.
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
Ch 6: JavaScript Introduction to scripting part 2.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 2 Chapter 2 - Introduction to C Programming.
 Pearson Education, Inc. All rights reserved Introduction to Java Applications.
Dr. Qusai Abuein1 Internet & WWW How to program Chap.(6) JavaScript:Introduction to Scripting.
Introduction to Visual Basic Programming. Introduction Simple Program: Printing a Line of Text Another Simple Program: Adding Integers Memory Concepts.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
 2000 Deitel & Associates, Inc. All rights reserved. Outline 8.1Introduction 8.2A Simple Program: Printing a Line of Text in a Web Page 8.3Another JavaScript.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
1 Chapter 3 – JavaScript Outline Introduction Flowcharts Control Structures if Selection Structure if/else Selection Structure while Repetition Structure.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
JavaScript 1 COE 201- Computer Proficiency. Introduction JavaScript scripting language ▫Originally created by Netscape ▫Facilitates disciplined approach.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
Part:2.  Keywords are words with special meaning in JavaScript  Keyword var ◦ Used to declare the names of variables ◦ A variable is a location in the.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 3 – Introduction to C# Programming Outline 3.1 Introduction 3.2 Simple Program: Printing a Line.
Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing a Line of Text in a Web Page 7.3 Another JavaScript.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 2 - Introduction to C Programming Outline.
Adapted from  2004 Prentice Hall, Inc. All rights reserved. 5 th and 4 th ed: Chapters 6,7,8 SY306 Web and Databases for Cyber Operations SlideSet #6:
1 CISC181 Introduction to Computer Science Dr. McCoy Lecture 2 September 3, 2009.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
 2003 Prentice Hall, Inc. All rights reserved Basics of a Typical C++ Environment C++ systems –Program-development environment –Language –C++
REEM ALMOTIRI Information Technology Department Majmaah University.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
1 Lecture 2 - Introduction to C Programming Outline 2.1Introduction 2.2A Simple C Program: Printing a Line of Text 2.3Another Simple C Program: Adding.
 2001 Prentice Hall, Inc. All rights reserved. Outline 1 JavaScript.
Chapter 6 JavaScript: Introduction to Scripting
Chapter 2 - Introduction to C Programming
Chapter 13 - JavaScript/JScript: Introduction to Scripting
Introduction to Scripting
Chapter 2 - Introduction to C Programming
Chapter 7 - JavaScript: Introduction to Scripting
Chapter 2 - Introduction to C Programming
Chapter 2 - Introduction to C Programming
JavaScript: Introduction to Scripting
WEB PROGRAMMING JavaScript.
Chapter 2 - Introduction to C Programming
Chapter 2 - Introduction to C Programming
Chapter 7 - JavaScript: Introduction to Scripting
Chapter 2 - Introduction to C Programming
JavaScript: Introduction to Scripting
Chapter 7 - JavaScript: Introduction to Scripting
Chapter 7 - JavaScript: Introduction to Scripting
Chapter 7 - JavaScript: Introduction to Scripting
Presentation transcript:

 2003 Prentice Hall, Inc. All rights reserved. Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing a Line of Text in a Web Page 7.3 Obtaining User Input with prompt Dialogs 7.3.1Dynamic Welcome Page 7.3.2Adding Integers 7.4 Memory Concepts 7.5 Arithmetic 7.6 Decision Making: Equality and Relational Operators 7.7 Web Resources

 2003 Prentice Hall, Inc. All rights reserved. Objectives In this lesson, you will learn: –To be able to write simple JavaScript programs. –To be able to use input and output statements. –To understand basic memory concepts. –To be able to use arithmetic operators. –To understand the precedence of arithmetic operators. –To be able to write decision-making statements. –To be able to use relational and equality operators.

 2003 Prentice Hall, Inc. All rights reserved. 7.1 Introduction JavaScript scripting language –Enhances functionality and appearance –Client-side scripting Makes pages more dynamic and interactive –Foundation for complex server-side scripting –Program development –Program control

 2003 Prentice Hall, Inc. All rights reserved. 7.2 Simple Program: Printing a Line of Text in a Web Page Inline scripting –Written in the of a document – tag Indicate that the text is part of a script type attribute –Specifies the type of file and the scripting language use writeln method –Write a line in the document Escape character ( \ ) –Indicates “special” character is used in the string alert method –Dialog box

 2003 Prentice Hall, Inc. All rights reserved. Outline  2003 Prentice Hall, Inc. All rights reserved. Outline welcome.html (1 of 1)

 2003 Prentice Hall, Inc. All rights reserved. Outline  2003 Prentice Hall, Inc. All rights reserved. Outline welcome2.html (1 of 1)

 2003 Prentice Hall, Inc. All rights reserved. Outline  2003 Prentice Hall, Inc. All rights reserved. Outline welcome3.html 1 of 1

 2003 Prentice Hall, Inc. All rights reserved. Outline  2003 Prentice Hall, Inc. All rights reserved. Outline welcome4.html 1 of 1

 2003 Prentice Hall, Inc. All rights reserved.

7.2 Simple Program: Printing a Line of Text in a Web Page

 2003 Prentice Hall, Inc. All rights reserved Dynamic Welcome Page A script can adapt the content based on input from the user or other variables

 2003 Prentice Hall, Inc. All rights reserved. Outline  2003 Prentice Hall, Inc. All rights reserved. Outline welcome5.html (1 of 2)

 2003 Prentice Hall, Inc. All rights reserved. Outline  2003 Prentice Hall, Inc. All rights reserved. Outline welcome5.html (2 of 2)

 2003 Prentice Hall, Inc. All rights reserved Dynamic Welcome Page Fig. 7.7Prompt dialog displayed by the window object’s prompt method. This is the prompt to the user. This is the default value that appears when the dialog opens. This is the text field in which the user types the value. When the user clicks OK, the value typed by the user is returned to the program as a string.

 2003 Prentice Hall, Inc. All rights reserved Adding Integers Prompt user for two integers and calculate the sum (Fig. 7.8) NaN (not a number) parseInt –Converts its string argument to an integer

 2003 Prentice Hall, Inc. All rights reserved. Outline  2003 Prentice Hall, Inc. All rights reserved. Outline Addition.html (1 of 2)

 2003 Prentice Hall, Inc. All rights reserved. Outline  2003 Prentice Hall, Inc. All rights reserved. Outline Addition.html (2 of 2)

 2003 Prentice Hall, Inc. All rights reserved.

7.4 Memory Concepts Variable names correspond to locations in the computer’s memory Every variable has a name, a type, and a value Read value from a memory location –nondestructive

 2003 Prentice Hall, Inc. All rights reserved. 7.4 Memory Concepts number145 Fig. 7.9Memory location showing the name and value of variable number1.

 2003 Prentice Hall, Inc. All rights reserved. 7.4 Memory Concepts number145 number272 Fig. 7.10Memory locations after values for variables number1 and number2 have been input.

 2003 Prentice Hall, Inc. All rights reserved. 7.4 Memory Concepts number145 number272 sum117 Fig. 7.11Memory locations after calculating the sum of number1 and number2.

 2003 Prentice Hall, Inc. All rights reserved. 7.5 Arithmetic Many scripts perform arithmetic calculations –Expressions in JavaScript must be written in straight-line form

 2003 Prentice Hall, Inc. All rights reserved. 7.5 Arithmetic

 2003 Prentice Hall, Inc. All rights reserved. 7.5 Arithmetic y = 2 * 5 * * 5 + 7; 2 * 5 is 10 (Leftmost multiplication) y = 10 * * 5 + 7; 10 * 5 is 50 (Leftmost multiplication) y = * 5 + 7; 3 * 5 is 15 (Multiplication before addition) y = ; is 65 (Leftmost addition) y = ; is 72 (Last addition) y = 72; (Last operation—place 72 into y ) Step 1. Step 2. Step 5. Step 3. Step 4. Step 6. Fig. 7.14Order in which a second-degree polynomial is evaluated.

 2003 Prentice Hall, Inc. All rights reserved. 7.6 Decision Making: Equality and Relational Operators Decision based on the truth or falsity of a condition –Equality operators –Relational operators

 2003 Prentice Hall, Inc. All rights reserved. 7.6 Decision Making: Equality and Relational Operators  

 2003 Prentice Hall, Inc. All rights reserved. Outline  2003 Prentice Hall, Inc. All rights reserved. Outline welcome6.html (1 of 3)

 2003 Prentice Hall, Inc. All rights reserved. Outline  2003 Prentice Hall, Inc. All rights reserved. Outline welcome6.html (2 of 3)

 2003 Prentice Hall, Inc. All rights reserved. Outline  2003 Prentice Hall, Inc. All rights reserved. Outline welcome6.html (3 of 3)

 2003 Prentice Hall, Inc. All rights reserved. 7.6 Decision Making: Equality and Relational Operators