Introduction to JavaScript MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 2/2/2016.

Slides:



Advertisements
Similar presentations
Javascript Introduction Norman White Material is from w3schools.com Go there to run examples interactively.
Advertisements

Introduction to PHP MIS 3501, Fall 2014 Jeremy Shafer
The Web Warrior Guide to Web Design Technologies
PHP Conditions MIS 3501, Fall 2014 Jeremy Shafer Department of MIS Fox School of Business Temple University September 11, 2014.
Forms, Validation Week 7 INFM 603. Announcements Try placing today’s example in htdocs (XAMPP). This will allow you to execute examples that rely on PHP.
Introduction to PHP and Server Side Technology. Slide 2 PHP History Created in 1995 PHP 5.0 is the current version It’s been around since 2004.
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.
Chapter 5 Java Script And Forms JavaScript, Third Edition.
JavaScript Defined DOM (Document Object Model) General Syntax Body vs. Head Variables Math & Logic Selection Functions & Events Loops Animation Getting.
Bridges To Computing General Information: This document was created for use in the "Bridges to Computing" project of Brooklyn College. You are invited.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
CSS Class 7 Add JavaScript to your page Add event handlers Validate a form Open a new window Hide and show elements Swap images Debug JavaScript.
SEG3210 DHTML Tutorial. DHTML DHTML is a combination of technologies used to create dynamic and interactive Web sites. –HTML - For creating text and image.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
What is Java Script? An extension to HTML. An extension to HTML. Allows authors to incorporate some functionality in their web pages. (without using CGI.
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
JavaScript Syntax, how to use it in a HTML document
JavaScript - Basic Concepts Prepared and Presented by Hienvinh Nguyen, Afshin Tiraie.
Overview of Form and Javascript fundamentals. Brief matching exercise 1. This is the software that allows a user to access and view HTML documents 2.
4. Javascript M. Udin Harun Al Rasyid, S.Kom, Ph.D Lab Jaringan Komputer (C-307) Desain.
JavaScript Defined DOM (Document Object Model) General Syntax Body vs. Head Variables Math & Logic Selection Functions & Events Loops Animation Getting.
Introduction to JavaScript CSc 2320 Fall 2014 Disclaimer: All words, pictures are adopted from “Simple JavaScript”by Kevin Yank and Cameron Adams and also.
Class06 Conditional Statements MIS 3501, Fall 2015 Brad Greenwood, PhD MBA Department of MIS Fox School of Business Temple University 9/10/2015 © 2014,
JavaScript. JavaScript Introduction JavaScript is the world's most popular programming language. It is the language for HTML and the web, for servers,
Class02 More Arrays MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 1/14/2016.
Introduction to Javascript. What is javascript?  The most popular web scripting language in the world  Used to produce rich thin client web applications.
Introduction to AJAX MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 2/4/2016.
Javascript Basic Concepts Presentation By: Er. Sunny Chanday Lecturer CSE/IT RBIENT.
JavaScript and Ajax (JavaScript Environment) Week 6 Web site:
Sessions and cookies MIS 3501, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 4/12/2016.
Introduction to JavaScript MIS 3502, Fall 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 9/29/2016.
Unit M Programming Web Pages with
JavaScript is a programming language designed for Web pages.
Unit M Programming Web Pages with
4. Javascript Pemrograman Web I Program Studi Teknik Informatika
JavaScript.
How to get data from a form
Introduction to AJAX MIS 3502 Jeremy Shafer Department of MIS
Introduction to JavaScript
JavaScript Introduction
JavaScript an introduction.
Web Systems Development (CSC-215)
DHTML Javascript Internet Technology.
Introduction to AJAX MIS 3502 Jeremy Shafer Department of MIS
A second look at JavaScript
Organize your code with MVC
DHTML Javascript Internet Technology.
Class07 PHP: loops MIS 3501 Jeremy Shafer Department of MIS
MIS JavaScript and API Workshop (Part 3)
Introduction to AJAX and JSON
An Introduction to JavaScript
Introduction to JavaScript
JavaScript CS 4640 Programming Languages for Web Applications
Tutorial 10: Programming with javascript
An introduction to jQuery
JavaScript Basics What is JavaScript?
JavaScript is a scripting language designed for Web pages by Netscape.
An Introduction to JavaScript
An introduction to jQuery
Introduction to AJAX and JSON
Ajax and JSON Jeremy Shafer Department of MIS Fox School of Business
Client-Server Model: Requesting a Web Page
Ajax and JSON Jeremy Shafer Department of MIS Fox School of Business
Web Programming and Design
Web Programming and Design
Web Programming and Design
JavaScript CS 4640 Programming Languages for Web Applications
Presentation transcript:

Introduction to JavaScript MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 2/2/2016

Course Overview Slide 2 New tools Weeks Using a web framework Weeks 6 -8 Using a mobile device IDE Weeks 9-10 The class project (It’s a bake off!) Weeks We are (still) here Arrays PDO MVC JavaScript / JSON

Objectives Slide 3 Where does JavaScript run? How is JavaScript syntax different from PHP? Where does the JavaScript go? What’s a good basic use of JavaScript?

Where does JavaScript run? Slide 4 URL, referencing a.php page HTTP Response Database PHP Interpreter Browser JavaScript Engine As a general rule, JavaScript lives here, in the browser, and does not interact with any resource outside the browser. This is called a “round trip”

Discuss: Similarities and Differences Slide 5 How is JavaScript syntax similar to PHP? Both draw syntax conventions from the C programming language Statements end in semicolon (usually) Use curly braces {} for code blocks functions declared and used in a similar manner Comparison and assignment operators the same Conditional statements and loops work the same. Case sensitive

Discuss: Similarities and Differences Slide 6 How is JavaScript syntax different from PHP? Variables do not need to start with $ JavaScript code is visible via the “View Source” feature of your browser. It appears inside the tag. Use document.write("Hello World!"); instead of echo("Hello World!"); Concatenation character is “ + ” not “. ” There is no variable substitution in strings. The library of functions is different Variables are declared using var The object operator is different. JavaScript uses a “.” and not a “ -> ” JavaScript has what’s known as the Document Object Model

The DOM (Document Object Model) Slide 7 JavaScript can change all the HTML elements in the page JavaScript can change all the HTML attributes in the page JavaScript can change all the CSS styles in the page JavaScript can remove existing HTML elements and attributes JavaScript can add new HTML elements and attributes JavaScript can react to all existing HTML events in the page JavaScript can create new HTML events in the page Source: All of these activities are accomplished through the properties and methods of objects.

Slide 8 We will see an example of this momentarily…

Where does JavaScript go? Slide 9 You can put a tag here, in the head. (My personal preference and what I see most often.) Or here… right before the closing body tag.

Where does JavaScript go? (2) Slide 10 Another option is to use the src attribute of the tag.

Let’s give it a try… Slide 11 See the example javascriptdemo.html Review its functionality. Do some refactoring: –Extract the contents of the tag into its own file, and refer to it using the src attribute of the tag. –Extract the contents of the tag into its own file, and refer to it using the href attribute of the tag.

Lot’s of things, actually. Whole applications can be written in JavaScript. Soon we will see how it can be used to asynchronously pull data from a web service. But for today we’ll consider a more simple case: form validation. In the most general terms, we use JavaScript to cut down on … So… what’s JavaScript good for? Slide 12

JavaScript for form validation Slide 13 Users can be notified of problems before their form is ever posted to the server Discuss: does this eliminate the need for server side validation of user provided data? Why?

To do Slide 14 See the example javascriptdemo2.html Review its functionality. Make special note of: –The onsubmit attribute of the form. If onsubmit is set to false, the form will not submit. –The user defined function named "validate". It will return either true or false. Complete the validation function so that all form fields are validated. –Note that JavaScript gives you a function called isNaN (short for “is not a number”) that returns true or false.

It’s time for challenge Slide 15