Web Systems Development (CSC-215)

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

JavaScript I. JavaScript is an object oriented programming language used to add interactivity to web pages. Different from Java, even though bears some.
JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
Java Script Session1 INTRODUCTION.
Javascript Client-side scripting. Up to now  We've seen a little about how to control  content with HTML  presentation with CSS  Javascript is a language.
Tutorial 10 Programming with JavaScript
CS 299 – Web Programming and Design Overview of JavaScript and DOM Instructor: Dr. Fang (Daisy) Tang.
PHP Server-side Programming. PHP  PHP stands for PHP: Hypertext Preprocessor  PHP is interpreted  PHP code is embedded into HTML code  interpreter.
WEB DESIGN AND PROGRAMMING Introduction to Javascript.
Database-Driven Web Sites, Second Edition1 Chapter 3 INTRODUCTION TO CLIENT-SIDE SCRIPTS.
Javascript. Outline Introduction Fundamental of JavaScript Javascript events management DOM and Dynamic HTML (DHTML)
JavaScript. Overview Introduction: JavaScript basics Expressions and types Expressions and types Arrays Arrays Objects and Associative Arrays Objects.
1 JavaScript in Context. Server-Side Programming.
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
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
20-753: Fundamentals of Web Programming 1 Lecture 12: Javascript I Fundamentals of Web Programming Lecture 12: Introduction to Javascript.
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.
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.
05 – Java Script (1) Informatics Department Parahyangan Catholic University.
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.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
Chapter 2 Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc.Slide 1.
Introduction to JavaScript CSc 2320 Fall 2014 Disclaimer: All words, pictures are adopted from “Simple JavaScript”by Kevin Yank and Cameron Adams and also.
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
1 PHP Intro PHP Introduction After this lecture, you should be able to: Know the fundamental concepts of Web Scripting Languages in general, PHP in particular.
JavaScript Introduction and Background. 2 Web languages Three formal languages HTML JavaScript CSS Three different tasks Document description Client-side.
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.
Introduction to Javascript. What is javascript?  The most popular web scripting language in the world  Used to produce rich thin client web applications.
CGS 3066: Web Programming and Design Spring 2016 Introduction to JavaScript.
REEM ALMOTIRI Information Technology Department Majmaah University.
JavaScript and AJAX 2nd Edition Tutorial 1 Programming with JavaScript.
© 2010 Robert K. Moniot1 Chapter 6 Introduction to JavaScript.
Introduction to JavaScript MIS 3502, Fall 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 9/29/2016.
Introduction to.
>> Introduction to JavaScript
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Chapter 6 JavaScript: Introduction to Scripting
Tutorial 10 Programming with JavaScript
Donna J. Kain, Clarkson University
Exploring JavaScript Ch 14
Intro to PHP & Variables
Introduction to JavaScript
Web Systems Development (CSC-215)
HTML Forms and User Input
Chapter 7 - JavaScript: Introduction to Scripting
JavaScript Introduction
JavaScript and Ajax (Expression and Operators)
JavaScript an introduction.
Objectives Insert a script element Write JavaScript comments
Web Systems Development (CSC-215)
PHP.
T. Jumana Abu Shmais – AOU - Riyadh
HYPERTEXT PREPROCESSOR BY : UMA KAKKAR
Tutorial 10 Programming with JavaScript
Introduction to JavaScript
JavaScript CS 4640 Programming Languages for Web Applications
Chapter 7 - JavaScript: Introduction to Scripting
The <script> Tag
Chapter 7 - JavaScript: Introduction to Scripting
PHP an introduction.
CS3220 Web and Internet Programming JavaScript Basics
Web Programming and Design
Web Programming and Design
JavaScript CS 4640 Programming Languages for Web Applications
Chapter 7 - JavaScript: Introduction to Scripting
Presentation transcript:

Web Systems Development (CSC-215) Lecture 15: Introduction to JavaScript Monday 23rd April 2018

Javascript: dynamic functionality for websites

Offers functionality that is not otherwise possible because it runs in the browser and has direct access to all elements in a web page

JavaScript First appearance in Netscape Navigator in 1995 Not related to Java Grew more powerful when HTML started using the Document Object Model Like PHP, follows programming syntax of C Heart of Ajax (which along with HTML5 helps produce fluid front ends)

JavaScript & HTML Runs entirely within web browsers

Scripts in <head> When you want it to run when the page loads When it includes a function call that will be needed multiple times …

Including JavaScript Files The script files themselves (.js) should NOT contain any <script> tags

Debugging JavaScript Errors Use browser tools PHP errors were standard, JavaScript error handling will be browser implementation dependent For example Firefox -> Tools -> Web Developer -> Web Console

Syntax overview

Comments: C++ style // /* */

Semi colons: optional – unless there are multiple statements on a single line

Variable names: Like c++ except that $ is allowed Variable names: Like c++ except that $ is allowed. Not using it is good practice.

String Variables Double or single quotes

Escaping

String Assignment & Use

Numeric Variables

Arrays

Accessing Array Values

Arithmetic Operators

Logical Operators

String Concatenation

typeof

Functions

Globals Define outside of functions

Document object model

Document Object Model JavaScript built in the context of the DOM The DOM breaks down parts of an HTML document into discrete objects Each with its own properties and methods Each subject to JavaScript’s control

JavaScript Objects, Methods & Properties

DOM: Hierarchy of Parent & Child Elements

Short Form

Safe & Conventional Form Previous ones might not work in IE

Shortcut

Using the DOM The links value is an array

Using the DOM Retrieve length of array

Using the DOM Extract and display all links

Using the DOM Referencing history

Using the DOM Replace currently loaded URL

Expressions and Control Flow Syntax overview

Expressions Similar to C++, PHP in style

True/False All values evaluate to true except The string false -0 -0 Empty string Null Undefined NaN (not a number, e.g., after division by zero)

Literals & Variables

Simple Statements

Operator Precedence

OnError

Try Catch

If

Else

While

Do While

Explicit Casting

Class Activity Create a JavaScript program that inputs a number n from a user and then displays the sum to n For n = 5 output 1 + 2 + 3 + 4 + 5 = 15

Class Activity Using prompt/alert boxes for input/ouput

Lecture content adapted from chapter 14 & 15 of Learning PHP, MySQL, JavaScript, CSS & HTML5.