JavaScript: A short introduction Joseph Lee Created by Joseph Lee.

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 Objects - DOM CST 200 JavaScript. Objectives Introduce JavaScript objects Introduce Document Object Model Introduce window object Introduce.
1 CSC 551: Web Programming Spring 2004 client-side programming with JavaScript  scripts vs. programs  JavaScript vs. JScript vs. VBScript  common tasks.
The Web Warrior Guide to Web Design Technologies
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic JavaScript: Introduction to Scripting.
1 HCI 201 JavaScript - Part 1. 2 Static web pages l Static pages: what we have worked with so far l HTML tags tell the browser what to do with the content.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
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.
Introduction to JavaScript. Aim To enable you to write you first JavaScript.
Introduction to scripting
Javascript and the Web Whys and Hows of Javascript.
4.1 JavaScript Introduction
JavaScript: Control Structures September 27, 2005 Slides modified from Internet & World Wide Web: How to Program (3rd) edition. By Deitel, Deitel,
WEB DESIGN AND PROGRAMMING Introduction to Javascript.
CS346 - Javascript 1, 21 Module 1 Introduction to JavaScript CS346.
JavaScript, Fifth Edition Chapter 1 Introduction to JavaScript.
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
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.
Generations of Programming Languages First generation  Machine Language Second Generation  Assembly Language Third Generation  Procedural language such.
Week 9 PHP Cookies and Session Introduction to JavaScript.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
Dynamic Web Pages & JavaScript. Dynamic Web Pages Dynamic = Change Dynamic Web Pages are web pages that change. More than just moving graphics around.
Lecture 9 The Basics of JavaScript Boriana Koleva Room: C54
The Grammar of JavaScript.  Each line of a script is a statement  An instruction that JavaScript can evaluate (make sense of)  Ends with a semicolon;
Introduction.  The scripting language most often used for client-side web development.  Influenced by many programming languages, easier for nonprogrammers.
JS Basics 1 Lecture JavaScript - Basics. JS Basics 2 What is JavaScript JavaScript is a “simple”, interpreted, programming language with elementary object-
JavaScript Programming Unit #1: Introduction. What is Programming?
JavaScript Syntax, how to use it in a HTML document
Introduction to JavaScript CS101 Introduction to Computing.
JavaScript Scripting language What is Scripting ? A scripting language, script language, or extension language is a programming language.
1 A Balanced Introduction to Computer Science David Reed, Creighton University ©2005 Pearson Prentice Hall ISBN X Chapter 4 JavaScript and.
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.
4. Javascript M. Udin Harun Al Rasyid, S.Kom, Ph.D Lab Jaringan Komputer (C-307) Desain.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
Introduction into JavaScript Java 1 JavaScript JavaScript programs run from within an HTML document The statements that make up a program in an HTML.
CIS 375—Web App Dev II JavaScript I. 2 Introduction to DTD JavaScript is a scripting language developed by ________. A scripting language is a lightweight.
JavaScript Defined DOM (Document Object Model) General Syntax Body vs. Head Variables Math & Logic Selection Functions & Events Loops Animation Getting.
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.
Part:2.  Keywords are words with special meaning in JavaScript  Keyword var ◦ Used to declare the names of variables ◦ A variable is a location in the.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
Introduction to JavaScript CSc 2320 Fall 2014 Disclaimer: All words, pictures are adopted from “Simple JavaScript”by Kevin Yank and Cameron Adams and also.
JavaScript Introduction and Background. 2 Web languages Three formal languages HTML JavaScript CSS Three different tasks Document description Client-side.
Javascript Basic Concepts Presentation By: Er. Sunny Chanday Lecturer CSE/IT RBIENT.
CGS 3066: Web Programming and Design Spring 2016 Introduction to JavaScript.
1 JavaScript and Dynamic Web Pages Lecture 7. 2 Static vs. Dynamic Pages  A Web page uses HTML tags to identify page content and formatting information.
REEM ALMOTIRI Information Technology Department Majmaah University.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
CGS 3066: Web Programming and Design Spring 2017
Module 1 Introduction to JavaScript
Chapter 6 JavaScript: Introduction to Scripting
“Under the hood”: Angry Birds Maze
JavaScript is a programming language designed for Web pages.
Donna J. Kain, Clarkson University
Introduction to Scripting
JavaScript.
WEB PROGRAMMING JavaScript.
T. Jumana Abu Shmais – AOU - Riyadh
Introduction to JavaScript
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:

JavaScript: A short introduction Joseph Lee Created by Joseph Lee

2 Introduction an interpreted programming language object-oriented capabilities scripts embedded in HTML documents not Java simplified not simple :-(

Created by Joseph Lee3 Example: Executable Content JavaScript for (i=1; i<=9; i++) document.write("2 * ", i, " = ", 2*i, " ")

Created by Joseph Lee4 JavaScript Can Control Document Appearance and Content Control the Browser Interact with Document Content Interact with the User Read and Write Client State with Cookies Interact with Applets Manipulate Embedded Images and more …

Created by Joseph Lee5 JavaScript Can’t lack of graphics capabilities, does not allow the reading or writing of files for security reasons does not support networking does not have any multithreading capabilities

Created by Joseph Lee6 Variables a name associated with a data value to store and manipulate data in our programs, e.g., i = 3; sum = i + 4; declaration is not necessary, but recommended using the var keyword, e.g., var i = 3; var sum;

Created by Joseph Lee7 JavaScript is untyped! In Java, int i; boolean checked; In JavaScript, var i; var checked;

Created by Joseph Lee8 Untyped? variables can hold values of any data type, e.g, i = 20; i = "Hello world." values are conveniently and automatically converted from one type to another, e.g., i = "20"; sum = 7 + i;

Created by Joseph Lee9 Strings a string of letters, digits, punctuation characters, and so on data type for representing text string literals may be included in your programs by enclosing them in matching pairs of single (' ' ) or double quotes (" ")

Created by Joseph Lee10 Strings Operations concatenation msg = "hello" + "world"; length of a string msg.length to extract a character from a string msg.charAt(0) // the first character msg.charAt(msg.length-1) // the last char to extract part of a string msg.substring(0, 5) // a 5-char string starting at index 0

Created by Joseph Lee11 JavaScript Object Model Basic terminology: –objects state (data) -> instance variable (property) message -> method –classes –inheritance –polymorphism

Created by Joseph Lee12 Objects and Properties msg.length name of object name of property dot needed to access a property

Created by Joseph Lee13 Objects and Methods document.write("Hello world") name of object name of method dot needed to access a method argument(s) included in parentheses

Created by Joseph Lee14 Example 1: Alert box window.alert("Hello World")

Created by Joseph Lee15 Example 2: Read/Set Properties document.bgColor = "yellow" window.alert(document.bgColor)

Created by Joseph Lee16 Example 3: Prompt var username = window.prompt("What is your name?", "") document.write(" Hello ", username, " ")

Created by Joseph Lee17 Adding Comments <!-- Old browsers will ignore the script // username holds the name input by user var username = window.prompt("What is your name?", "") // display a greeting message document.write(" Hello ", username, " ") // -- > HTML comments JavaScript comments

Created by Joseph Lee18 Mixing JavaScript and HTML Today is : document.write(new Date()) This page was modified on: document.write(document.lastModified)