Introduction to JavaScript MIS 3502, Fall 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 9/29/2016.

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

JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
Introduction to PHP MIS 3501, Fall 2014 Jeremy Shafer
The Web Warrior Guide to Web Design Technologies
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.
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.
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
JavaScript Syntax, how to use it in a HTML document
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.
ECA 225 Applied Interactive Programming1 ECA 225 Applied Online Programming basics.
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 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.
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.
PHP using MySQL Database for Web Development (part II)
Java Script Introduction. Java Script Introduction.
Unit M Programming Web Pages with
Week 4: Introduction to Javascript
JavaScript is a programming language designed for Web pages.
JavaScript Event Handling.
Unit M Programming Web Pages with
* Lecture # 7 Instructor: Rida Noor Department of Computer Science
JavaScript Functions.
JavaScript Syntax and Semantics
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.
DHTML Javascript Internet Technology.
Introduction to AJAX MIS 3502 Jeremy Shafer Department of MIS
A second look at JavaScript
DHTML Javascript Internet Technology.
PHP.
MIS JavaScript and API Workshop (Part 3)
Introduction to AJAX and JSON
MIS JavaScript and API Workshop (Part 2)
An Introduction to JavaScript
Getting started with jQuery
Loops and Arrays in 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
Introduction to MIS2402 MIS MIS2402 Jeremy Shafer Department of MIS
PHP an introduction.
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
JavaScript CS 4640 Programming Languages for Web Applications
Presentation transcript:

Introduction to JavaScript MIS 3502, Fall 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 9/29/2016

Objectives Slide 2 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 3 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 4 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 5 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 6 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 7 We will see an example of this momentarily…

Where does JavaScript go? Slide 8 You can put a tag here, in the head. (My personal preference.) Or here… right before the closing body tag.

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

Let’s give it a try… Slide 10 See the example javascriptdemo.html Review its functionality. Try it out.

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 11

JavaScript for form validation Slide 12 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 13 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 a challenge Slide 14