Introduction to JavaScript CSc 2320 Fall 2014 Disclaimer: All words, pictures are adopted from “Simple JavaScript”by Kevin Yank and Cameron Adams and also.

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.
Sue Wills July Objects The JavaScript language is completely centered around objects, and because of this, it is known as an Object Oriented Programming.
JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
Javascript It’s not JAVA. What do these all have in common?
Programming with JavaScript CSc 2320 Fall 2014 Disclaimer: All words, pictures are adopted from “Simple JavaScript”by Kevin Yank and Cameron Adams and.
The Web Warrior Guide to Web Design Technologies
Working with JavaScript. 2 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page Working with Variables.
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
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.
CS 299 – Web Programming and Design Overview of JavaScript and DOM Instructor: Dr. Fang (Daisy) Tang.
JavaScript CMPT 281. Outline Introduction to JavaScript Resources What is JavaScript? JavaScript in web pages.
Javascript and the Web Whys and Hows of Javascript.
WEB DESIGN AND PROGRAMMING Introduction to Javascript.
JavaScript, Fifth Edition Chapter 1 Introduction to JavaScript.
Created by, Author Name, School Name—State FLUENCY WITH INFORMATION TECNOLOGY Skills, Concepts, and Capabilities.
NMED 3850 A Advanced Online Design January 26, 2010 V. Mahadevan.
CSC 330 E-Commerce Teacher Ahmed Mumtaz Mustehsan Ahmed Mumtaz Mustehsan GM-IT CIIT Islamabad GM-IT CIIT Islamabad CIIT Virtual Campus, CIIT COMSATS Institute.
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.
Javascript. Outline Introduction Fundamental of JavaScript Javascript events management DOM and Dynamic HTML (DHTML)
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
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?
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
DHTML AND JAVASCRIPT Genetic Computer School LESSON 5 INTRODUCTION JAVASCRIPT G H E F.
Introduction.  The scripting language most often used for client-side web development.  Influenced by many programming languages, easier for nonprogrammers.
Browser Object Model& Debugging CSc 2320 Fall 2014 Disclaimer: All words, pictures are adopted from “Simple JavaScript”by Kevin Yank and Cameron Adams.
Events and Animations CSc 2320 Fall 2014 Disclaimer: All words, pictures are adopted from “Simple JavaScript”by Kevin Yank and Cameron Adams and also from.
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 JavaScript
JavaScript Syntax, how to use it in a HTML document
Introduction to Programming JScript Six Scripting functions Discuss functions Password Example.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
JavaScript Introduction.  JavaScript is a scripting language  A scripting language is a lightweight programming language  A JavaScript can be inserted.
4. Javascript M. Udin Harun Al Rasyid, S.Kom, Ph.D Lab Jaringan Komputer (C-307) Desain.
Java Script About Java Script Document Object Model Incorporating JavaScript Adding JavaScript to HTML Embedding a Javascript External Scripts Javascript.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
JavaScript. JavaScript Introduction JavaScript is the world's most popular programming language. It is the language for HTML and the web, for servers,
Document Object Model CSc 2320 Fall 2014 Disclaimer: All words, pictures are adopted from “Simple JavaScript”by Kevin Yank and Cameron Adams and also from.
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.
Expressions and Data Types Professor Robin Burke.
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.
CGS 3066: Web Programming and Design Spring 2016 Introduction to JavaScript.
JavaScript and AJAX 2nd Edition Tutorial 1 Programming with JavaScript.
XP Tutorial 10New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties.
Introduction to JavaScript MIS 3502, Fall 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 9/29/2016.
CGS 3066: Web Programming and Design Spring 2017
Build in Objects In JavaScript, almost "everything" is an object.
Programming Web Pages with JavaScript
Chapter 6 JavaScript: Introduction to Scripting
JavaScript is a programming language designed for Web pages.
Intro to JavaScript CS 1150 Spring 2017.
Introduction to Scripting
4. Javascript Pemrograman Web I Program Studi Teknik Informatika
JavaScript.
JavaScript an introduction.
JavaScript What is JavaScript? What can JavaScript do?
Tutorial 10 Programming with JavaScript
JavaScript What is JavaScript? What can JavaScript do?
Tutorial 10: Programming with javascript
JavaScript Basics What is JavaScript?
JavaScript is a scripting language designed for Web pages by Netscape.
JavaScript: Introduction to Scripting
Presentation transcript:

Introduction to JavaScript CSc 2320 Fall 2014 Disclaimer: All words, pictures are adopted from “Simple JavaScript”by Kevin Yank and Cameron Adams and also from W3schools. Edited by Guoliang Liu, Only for Course CSc2320 at GSU CS Department

Resources Simple Javascript ◦ By kevin Yank and Cameron Adams W3Schools. ◦

In this chapter Introduction to JavaScript Three Layers of Web Programming with JavaScript ◦ Running a JavaScript Program ◦ Statements ◦ Comments ◦ Variable ◦ Date types ◦ Operations

Introduction to JavaScript JavaScript is a Scripting Language ◦ Lightweight programming language ◦ Programming code embedded in HTML ◦ Can be executed by all modern web browsers Java and JavaScript ◦ Nothing like each other but some syntax. Standardized JavaScript: ◦ ECMAScript (newest 5.1)

Three Layers of Web The way to create pages in the way back. ◦ HTML, CSS, JavaScript all in one file.

Separation of Three Layers HTML: Content CSS: Presentation JavaScript: Behavior

The third layer: Behavior JavaScript: Writing Into HTML Output JavaScript: Reacting to Events JavaScript: Changing HTML Element ◦ JavaScript: Changing HTML Content ◦ JavaScript: Changing HTML Images JavaScript: Changing HTML Styles JavaScript: Validate Input Check out the examples here: ◦

Programming with JavaScript Running a JavaScript Program Two ways to insert JavaScript code ◦ Internal: ◦ External:

JavaScript Statements In JavaScript each statement has to be separated by a new line or a semicolon. So, two statements could be written like this: Or Or both:

Comments Exactly the same with Java ◦ Single line: ◦ Multiple lines:

Variables: Store the data Declare a variable: ◦ var color; Declare and initialize: ◦ var color; ◦ color = “blue”; ◦ Or var color = “blue”; assignment operator (=).

Data Types for a variable Numbers ◦ integer or int. E.g., 3, 5, 100 ◦ Floating point number or float. E.g., ◦ var num = 5; ◦ var decimal = 10.2; Strings ◦ A series of characters coverd by ‘’ or “”  var single = 'Just single quotes';  var double = "Just double quotes";

Data Types for a variable Booleans ◦ True or false;  var lying = true;  var truthful = false; Arrays ◦ good ways to store individual pieces of data

Data Types for a variable Arrays (cont.) ◦ More examples:

Data Types for a variable Associative arrays: ◦ Key-value in the array

Operations for variables JavaScript Arithmetic Operators Given y = 5;

Operations for variables JavaScript Assignment Operators

Operations for variables The + Operator Used on Strings

Exercise Write a simple JavaScript to pop up an alert. ◦ No need to submit. Try the following code and see the difference: ◦ var a=“string”; var b=“2”; var c = a+b; alert(c); ◦ var a=“string”; var b=2; var c = a+b; alert(c); ◦ Output the same or not? If not, why? ◦ No need to submit.