Javascript. What is JavaScript? Scripting (interpreted) language designed for the web Beware: JavaScript is case sensitive.

Slides:



Advertisements
Similar presentations
The Web Wizards Guide To JavaScript Chapter 1 JavaScript Basics.
Advertisements

Introducing JavaScript
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.
1 COMM 1213 H1 COMP 4923 X1 JavaScript 1 (Readings: Ch. 10, 11 Knuckles)
Java Script Session1 INTRODUCTION.
The Web Warrior Guide to Web Design Technologies
12-Jun-15 JavaScript Language Fundamentals I. 2 About JavaScript JavaScript is not Java, or even related to Java The original name for JavaScript was.
1 Owais Mohammad Haq Department of Computer Science Eastern Michigan University April, 2005 Java Script.
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.
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
HTML Recall that HTML is static in that it describes how a page is to be displayed, but it doesn’t provide for interaction or animation. A page created.
XP 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial 10.
JavaScript Programming an Introduction Prepared By P.D. Krolak and M.S. Krolak Based on material from JavaScript Unleashed (2nd Ed)
JavaScript Programming an Introduction Prepared By P.D. Krolak and M.S. Krolak Based on material from JavaScript Unleashed (2nd Ed)
2012 •••••••••••••••••••••••••••••••••• Summer WorkShop Mostafa Badr
JavaScript Events and Event Handlers 1 An event is an action that occurs within a Web browser or Web document. An event handler is a statement that tells.
JavaScript CMPT 281. Outline Introduction to JavaScript Resources What is JavaScript? JavaScript in web pages.
JavaScript, Fifth Edition Chapter 1 Introduction to JavaScript.
Chapter 5 Java Script And Forms JavaScript, Third Edition.
Introduction to JavaScript Kirkwood Continuing Education © Copyright 2014, Fred McClurg All Rights Reserved.
Programming with JavaScript (Chapter 10). XP Various things Midterm grades: Friday Winter Career Fair – Thursday, April 28, 2011 (11 am to 3 pm). – MAC.
JavaScript Defined DOM (Document Object Model) General Syntax Body vs. Head Variables Math & Logic Selection Functions & Events Loops Animation Getting.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
Javascript Languages By Rapee kamoltalapisek ID:
© 2000 – All Rights Reserved - Page 1 Introduction to JavaScript Programming Part Two.
JavaScript Informatics for economists I. Introduction Programming language used in web pages. Simple and easy to use – written in HTML document. Client.
1 JavaScript. 2 What’s wrong with JavaScript? A very powerful language, yet –Often hated –Browser inconsistencies –Misunderstood –Developers find it painful.
CISC474 - JavaScript 03/02/2011. Some Background… Great JavaScript Guides: –
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
Javascript. Outline Introduction Fundamental of JavaScript Javascript events management DOM and Dynamic HTML (DHTML)
Lesson13. JavaScript JavaScript is an interpreted language, designed to function within a web browser. It can also be used on the server.
Chapter 4: Decision Making with Control Structures and Statements JavaScript - Introductory.
1 JavaScript in Context. Server-Side Programming.
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. XP Objectives Learn the history of JavaScript Create a script element Understand basic JavaScript syntax Write.
Using Client-Side Scripts to Enhance Web Applications 1.
ALBERT WAVERING BOBBY SENG. Week 4: JavaScript  Quiz  Announcements/questions.
XP Tutorial 10New Perspectives on HTML and XHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial.
Chapter 3 Functions, Events, and Control Structures JavaScript, Third Edition.
JavaScript Syntax, how to use it in a HTML document
05 – Java Script (1) Informatics Department Parahyangan Catholic University.
(1) JavaScript. (2) JavaScript vs. Java JavaScript and Java are completely different Java, invented by Sun in 1995, is a complex programming language.
1 JavaScript in Context. Server-Side Programming.
JavaScript Defined DOM (Document Object Model) General Syntax Body vs. Head Variables Math & Logic Selection Functions & Events Loops Animation Getting.
Pertemuan 5 IT133 Pengembangan Web JavaScript. What is JavaScript? JavaScript was designed to add interactivity to HTML pages JavaScript is a scripting.
“The world’s most misunderstood language has become the world’s most popular programming language” Akshay Arora
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
Javascript Basic Concepts Presentation By: Er. Sunny Chanday Lecturer CSE/IT RBIENT.
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.
The Web Wizard’s Guide To DHTML and CSS Chapter 2 A Review of CSS2 and JavaScript.
PHP using MySQL Database for Web Development (part II)
Chapter 19 JavaScript.
JavaScript Introduction
JavaScript an introduction.
The Web Wizard’s Guide To JavaScript
The Web Wizard’s Guide To JavaScript
Tutorial 10 Programming with JavaScript
JavaScript Overview By Kevin Harville.
JavaScript CS 4640 Programming Languages for Web Applications
Tutorial 10: Programming with javascript
The <script> Tag
Introduction to JavaScript
JavaScript CS 4640 Programming Languages for Web Applications
Presentation transcript:

Javascript

What is JavaScript? Scripting (interpreted) language designed for the web Beware: JavaScript is case sensitive

Why javascript? Supported by almost all browsers Very popular –Lots of scripts available for download Authoring programs such as Micromedia Flash and Director depend upon javascript External code libraries (*.js file) –Reuseable code

History Originally called LiveScript Invented by Brendan Eich at Netscape, 1995 Named changed to JavaScript because of Java Similar to Microsoft’s Jscript ECMA (European Standards Group) –Produced ECMAscript –JavaScript and JScript now based on ECMAscript

Objects JavaScript is object oriented –Web browser Window –HTML document Hierarchy defined by ‘dot syntax’ –Car.trunk.sparetire –Window.document.garden Refers to the garden image in a document in a window

Instance An incarnation of an object –car.trunk.sparetire –ford.trunk.sparetire –gm.trunk.sparetire

Properties Instances of objects can have properties –Window.document.bgColor

Values Properties have values –ford.color=“green”;

Variables Type of variable is determined by the data in it. Var defines a global variable myNewVariable = 0; –Defines a local variable called myNewVariable as a numeric value var myFavoriteColor = “teal”; Beetle.color = myFavoriteColor;

Arrays Collection of data (variable) Can hold any type of data var spiceRack = new Array(); spiceRack[0] = “oregano”; spiceRack[1] = “salt”; spiceRack[2] = “pepper”;

Methods An action associated with an object Methods can take values –ford.slowDown(“fast”); –ford.slowDown(“slow”); Methods can be triggered by events document.write(“Hi there!”);

Assignment Operators var myAge = 39; myAge += 4; // is the same as myAge = myAge + 4; myAge -=4; // is the same as myAge = myAge – 1; myAge *= 4; // is the same as myAge = myAge * 4; myAge /= 4; // is the same as myAge = myAge / 4;

Comparison Operators 39 == // returns true; 39 != // returns true; 39 > 28 // returns true; 39 >= 39 // returns true; 39 <= 36 // returns false;

Comparison Operators (15 == 10+5) && (33 == ); - And Logic - Returns false (15 == 10+5) || (33 = ); - Or Logic - Returns true

Conditional Statements (if) If (Condition) { statement 1; statement 2; } Else { }

Conditional Statements (switch) switch (expression) { case label1: //begins first case (action) statement1; statement2; break; case label2: //begins second case statement3; break; default: statement4; }

Loop Statements (for) For (initial value of a counter; ending value; increment) { statements; }

Loop Structures (while) While (condition is true) { statements; }

Loop Structures (Do) Do { statements; } while (condition is true);

Functions Group of JavaScript statements Invoked by JavaScript statements function doSomething(parm1, parm2, etc) { var theVisitor = parm1; window.document.write(“Is this OK, “ + theVisitor + “?”); }

Document Object Model Internal map of all objects on a Web Page Hierarchy Window Document Form Fields Links window.document.myForm.visitor.value Document.myForm.visitor.value

Events Objects encounter events Event Handler is the code that responds to an event

Write a JavaScript program that prints out even numbers from 0 to 10

Write a program that loads an array with the months of the year and them prints them out.