Chapter 19 JavaScript.

Slides:



Advertisements
Similar presentations
1 What is JavaScript? JavaScript was designed to add interactivity to HTML pages JavaScript is a scripting language A scripting language is a lightweight.
Advertisements

1 PHP Statement Constructs Server Scripting. 5-2 Basic Statement All Statements end in a semicolon. Statements are delimited from the HTML code by enclosing.
12-Jun-15 JavaScript Language Fundamentals I. 2 About JavaScript JavaScript is not Java, or even related to Java The original name for JavaScript was.
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.
2012 •••••••••••••••••••••••••••••••••• Summer WorkShop Mostafa Badr
Introduction to scripting
JavaScript, Fifth Edition Chapter 1 Introduction to JavaScript.
JavaScript – Part II Data Types and Operations George Mason University June 3, 2010.
Created by, Author Name, School Name—State FLUENCY WITH INFORMATION TECNOLOGY Skills, Concepts, and Capabilities.
SYST Web Technologies SYST Web Technologies Lesson 6 – Intro to JavaScript.
Chap 3 – PHP Quick Start COMP RL Professor Mattos.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
ASP.NET Programming with C# and SQL Server First Edition Chapter 3 Using Functions, Methods, and Control Structures.
CIS 375—Web App Dev II JavaScript II.
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.
XP Tutorial 10New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with JavaScript Creating a Programmable Web Page for North Pole.
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
Introduction to JavaScript Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan. 1.
Introduction to PHP A user navigates in her browser to a page that ends with a.php extension The request is sent to a web server, which directs the request.
ALBERT WAVERING BOBBY SENG. Week 4: JavaScript  Quiz  Announcements/questions.
Javascript. What is JavaScript? Scripting (interpreted) language designed for the web Beware: JavaScript is case sensitive.
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
XP Tutorial 10New Perspectives on HTML and XHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial.
Chapter 3 Functions, Events, and Control Structures JavaScript, Third Edition.
ECA 225 Applied Interactive Programming1 ECA 225 Applied Online Programming basics.
 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.
JavaScript, Fourth Edition
 2000 Deitel & Associates, Inc. All rights reserved. Chapter 10 - JavaScript/JScript: Control Structures II Outline 10.1Introduction 10.2Essentials of.
Chapter 15 JavaScript: Part III The Web Warrior Guide to Web Design Technologies.
4. Javascript M. Udin Harun Al Rasyid, S.Kom, Ph.D Lab Jaringan Komputer (C-307) Desain.
1 Server versus Client-Side Programming Server-SideClient-Side.
1 JavaScript in Context. Server-Side Programming.
Chapter 2 Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc.Slide 1.
FP512 WEB PROGRAMMING 1 PREPARED BY: PN. NUR SYUHADA BINTI MOHAMAD.
JavaScript. JavaScript Introduction JavaScript is the world's most popular programming language. It is the language for HTML and the web, for servers,
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
Sudeshna Sarkar, IIT Kharagpur 1 Programming and Data Structure Sudeshna Sarkar Lecture 3.
Introduction to Javascript. What is javascript?  The most popular web scripting language in the world  Used to produce rich thin client web applications.
Javascript Basic Concepts Presentation By: Er. Sunny Chanday Lecturer CSE/IT RBIENT.
JavaScript Tutorial. What is JavaScript JavaScript is the programming language of HTML and the Web Programming makes computers do what you want them to.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
PHP using MySQL Database for Web Development (part II)
Java Script Introduction. Java Script Introduction.
CHAPTER 4 DECISIONS & LOOPS
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Chapter 10 Programming Fundamentals with JavaScript
Chapter 6 JavaScript: Introduction to Scripting
Exam 2 Review.
JavaScript is a programming language designed for Web pages.
JavaScript Syntax and Semantics
PHP Introduction.
Chapter 6: Conditional Statements and Loops
JavaScript.
Chapter 10 Programming Fundamentals with JavaScript
Exercises on JavaScript & Revision
Javascript الجافا سكربت هي لغة برمجه اذا جاز التعبیر تلعب دور حیوي وفعال في صفحات الویب من خلال القیام بوظائف قد تكون خارجیة او داخلیة بل لنكن اكثر دقة.
Chapter 1: Computer Systems
PHP.
T. Jumana Abu Shmais – AOU - Riyadh
JavaScript What is JavaScript? What can JavaScript do?
JavaScript What is JavaScript? What can JavaScript do?
Tutorial 10: Programming with javascript
JavaScript Basics What is JavaScript?
JavaScript: Introduction to Scripting
Javascript Chapter 19 and 20 5/3/2019.
PHP an introduction.
Web Programming– UFCFB Lecture 13
Presentation transcript:

Chapter 19 JavaScript

JavaScript Interpretive programming language It’s designed to work inside web pages uses <script> tag Ex. <script language=“javascript”> </script> It can be embedded in anywhere in the XHTML code Nesting <script> tag generates a syntax error Case sensitive: sum, Sum, SUM are different

JavaScript You need to know three major things to learn a programming language now Language Syntax/Rules Event handling Object Oriented Programming (OOP) concept

JavaScript Language Syntax/Rules Variable: symbolic name can store a value Identifiers: begin with letter, underscore, or dollar sign Types: number = 30, 3.14, -25, -2.4 Boolean = true or false (reserved words) String = “25 dollars”, ‘totalvalue’ Var sum = 100; Name = “tim”; Scope: global V.S. local (“Var” statement) Constants: const pi = 3.14 Special character: \

JavaScript Statements: a line of JavaScript code Use “=“ sign -> x = 20; y = x; Must end with a “;” -> x = y + 20; Must not be broken in to two lines. Comments: // inline comments /* block comments */

JavaScript Expressions & Operators Assignment operators “=“, “+=“, “-=“, “*=“, “/=“ y = 30; x = x + y; x += y; Comparison operators == , !=, ===, !==, >, >=, <, <= A = (x == y); B = (z >= 20); Arithmetic operators +, -, *, /, %, ++, - -, and – (negative) x=10; ++x; x++; y=5; y- -; y++ Logical Operators && (and), II (or), ! (not) (T && F) (F && T) (F && F) (F || F) (! T) = False (T || F) (F || T) (T || T) (T && T) (! F) = True x = true; y=false; z = !( x && y); z = ?

JavaScript Control Structures - Conditional (if and switch) if (condition) {true block } else {false block} switch (expression) { case label1: statement; break; case label2: statement; break; default statement; } *see example 19.5

JavaScript Control Structures – loops for loop: Loops need a control value/counter to set the looping time for loop: for (initial value of counter; condition; increment) {looping statements} for (counter=0; counter<10; counter++) {document.write (“for loop = “ + counter + “<br/>”);} How many time does this loop go?

JavaScript Control Structures – loops while loop: while (condition) {{looping statements} counter = 0; while (counter < 10) {document.write (“while loop= “ + counter + “<br/>”); counter++; }// How many time does this loop go? See example 19.6, 19.7

JavaScript Control Structures – loops do while loop: do {looping statements} while (condition) counter = 0; do {document.write (“do while= “ + counter + “<br/>”); counter++; } while (counter < 10) How many time does this loop go?

JavaScript Control Structures – loops infinite loops: loop does not have a control value/counter to set the looping time

JavaScript document.write() // for web page output Window input and output method You should not put XHTML tags in output string Id = prompt(“string”, “initial value”) get_prompt = prompt(“click yes”, 7); Id = comfirm(“string”); Answer = comfirm(“the number is “ + x); alert (“string”) alert (“the answer is “ + x); document.write() // for web page output