Chapter 4 JavaScript and Dynamic Web pages. Objectives Static Web pages Dynamic Web pages JavaScript Variables Assignments. JavaScript Functions –(prompt(“”,””)

Slides:



Advertisements
Similar presentations
JavaScript I. JavaScript is an object oriented programming language used to add interactivity to web pages. Different from Java, even though bears some.
Advertisements

 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing.
1 CSC 551: Web Programming Spring 2004 client-side programming with JavaScript  scripts vs. programs  JavaScript vs. JScript vs. VBScript  common tasks.
The Web Warrior Guide to Web Design Technologies
Computer Science 103 Chapter 3 Introduction to JavaScript.
1 HCI 201 JavaScript - Part 1. 2 Static web pages l Static pages: what we have worked with so far l HTML tags tell the browser what to do with the content.
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.
Tutorial 10 Programming with JavaScript
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.
The Information School of the University of Washington Oct 20fit programming1 Programming Basics INFO/CSE 100, Fall 2006 Fluency in Information Technology.
2012 •••••••••••••••••••••••••••••••••• Summer WorkShop Mostafa Badr
Introduction to scripting
Javascript and the Web Whys and Hows of Javascript.
 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.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
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.
Objective Static vs. Dynamic Web pages. Variables. Assignments. JavaScript Hierarchy of Objects JavaScript Functions (prompt(“”,””) Document.write(“”)
Computers and Scientific Thinking David Reed, Creighton University JavaScript and User Interaction 1.
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
CHAPTER 4 Java Script อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
 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.
1 CSC 121 Computers and Scientific Thinking David Reed Creighton University JavaScript and Dynamic Web Pages.
JS Basics 1 Lecture JavaScript - Basics. JS Basics 2 What is JavaScript JavaScript is a “simple”, interpreted, programming language with elementary object-
XP Tutorial 10New Perspectives on HTML and XHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial.
Dr. Qusai Abuein1 Internet & WWW How to program Chap.(6) JavaScript:Introduction to Scripting.
1 A Balanced Introduction to Computer Science David Reed, Creighton University ©2005 Pearson Prentice Hall ISBN X Chapter 4 JavaScript and.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
1 A Balanced Introduction to Computer Science, 2/E David Reed, Creighton University ©2008 Pearson Prentice Hall ISBN Chapter 5 JavaScript.
 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 JavaScript in Context. Server-Side Programming.
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.
 2003 Prentice Hall, Inc. All rights reserved. Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing.
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.
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
JavaScript Introduction and Background. 2 Web languages Three formal languages HTML JavaScript CSS Three different tasks Document description Client-side.
CSC 121 Computers and Scientific Thinking Fall Interactive Web Pages.
1 Lesson 6 Introducing JavaScript HTML and JavaScript BASICS, 4 th Edition.
Expressions and Data Types Professor Robin Burke.
CGS 3066: Web Programming and Design Spring 2016 Introduction to JavaScript.
1 JavaScript and Dynamic Web Pages Lecture 7. 2 Static vs. Dynamic Pages  A Web page uses HTML tags to identify page content and formatting information.
1 CSC 121 Computers and Scientific Thinking David Reed Creighton University JavaScript and Dynamic Web Pages.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
IST 210: PHP Basics IST 210: Organization of Data IST2101.
 2001 Prentice Hall, Inc. All rights reserved. Outline 1 JavaScript.
CHAPTER 10 JAVA SCRIPT.
Chapter 6 JavaScript: Introduction to Scripting
Section 17.1 Section 17.2 Add an audio file using HTML
Introduction to Scripting
Chapter 7 - JavaScript: Introduction to Scripting
JavaScript: Introduction to Scripting
Chapter 4 JavaScript and Dynamic Web Pages
T. Jumana Abu Shmais – AOU - Riyadh
JavaScript What is JavaScript? What can JavaScript do?
JavaScript What is JavaScript? What can JavaScript do?
Chapter 7 - JavaScript: Introduction to Scripting
Chapter 7 - JavaScript: Introduction to Scripting
Chapter 7 - JavaScript: Introduction to Scripting
Chapter 5 JavaScript Numbers and Expressions
Presentation transcript:

Chapter 4 JavaScript and Dynamic Web pages

Objectives Static Web pages Dynamic Web pages JavaScript Variables Assignments. JavaScript Functions –(prompt(“”,””) –Document.write(“”) –Alert(“”)

Static Web Pages Looks the same and behave in the same manner each time they are loaded into a browser Content doesn’t change It doesn’t specifying dynamic behavior –Example html pages. A programming language is needed….

Dynamic Web pages Properties; –They are the pages that change while you are looking to them, –Varying their contents and responding to your actions.

Variables A variable is name used to symbolize a dynamic value. A variable can be used to represent a value. JavaScript variables: –tempInFahr, X, Y, x, y, Sum, SUM, sum, Sum2Date, Not variables: 2hotforU, salary$, two word,

Assigments = is the assignment statement. The value on the right side assigned to the variable on the left side. x = y+1; myName = john, myname= Jan. Y= 1; Y= 3;

X = X +1 –The current value of X is increased by 1, and the result is assigned back to x. Note; = is assignment operator. == is equality operator.

JavaScript Each Statement in a programming language specifies a particular action that the computer is to carry out, such as changing an image, opening a new window. JavaScript is simple programming language that adding dynamic features to Web pages. How? – the simplest way to add dynamic content to a Web page is to embed Java Script statements directly within the page using tags.

How to insert javascript in a webpage; Use the HTML tag pair and : alert(" your message goes here ");

Greetings hello Word, I like javascrip. …………………….. …………………… ……………………….. ………………….

Greetings firstName = prompt("Please enter your name", ""); document.write(" Hello " + firstName + ", welcome to my Web page. "); Whatever else you want to appear in your Web page...

A function Or Subroutine Take some variables, evaluate this variables and produce an output. –Example; F(x)=x+2, alert(“hello cc312”), prompt(“what is your name”, “”)

Alert(“….”) For creating a pop-up window Alert statement cause a new windows to appear and display a specified message Such as: –alert(" your message goes here ");

Prompt(“Some text”,””) When prompting the user for a value, the programmer can specify ( a string of characters enclosed in quotes) that serve as prompt message, followed by another string that specifies a default value for the prompt. Prompt(“my name is”, “”);

Document.write(“”) Document.write(() statement is used to display a message within the web page. Write statement can display text ( a string) or a combination of text and variables connected with ‘+’. Documet.write(“hello class cc3.12”);

Formating output Any sting in a write statement includes html tags will display just as any other text. –document.write(" Hello "+ firstName + ", welcome to my Web page. “ In general, JavaScript treats any sequence of characters enclosed in quotes as literal text.

Data types Integers –They are numbers, such as 1,2,3,4… Booleans; –True or False values Strings; –They are sequins of any kinds of data types. Such as “Brooklyn college”, “cc312”, this is 4 you”

Number Representation JavaScript automatically displays very large or very small values using scientific notation. –Example would be 1e5, X*10 y =XeY

Programming errors and Debugging Bug refers to an error in a program Debugging is the process of systematically locating and fixing errors in aprogram Three types errors can occur in a program: 1.Syntax errors are simple typographic errors. 2.Run-time errors occur when operations are applied to illegal values, such as dividing by 0. 3.Logic errors represent flaws in the design or implementation of program.

Math library functions Math.sqrt()  returns a square root of the input. Math.max (X,Y)  returns the greater of the two inputs. Math.min(X,Y)  returns the minimum number. Math.floor(2.564)  returns floor of a number, in this example it will return 2. Math.ceil(2.564)  returns ceil of a number, in here it would return 3.