Javascript It’s not JAVA. What do these all have in common?

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.
1 What is JavaScript? JavaScript was designed to add interactivity to HTML pages JavaScript is a scripting language A scripting language is a lightweight.
Lecture 4: Javascript Basics Javascript is a scripting language based on pieces of C, C++, shell scripts, Pascal, Java, etc. Scripts – loosely typed C++
JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
1 COMM 1213 H1 COMP 4923 X1 JavaScript 1 (Readings: Ch. 10, 11 Knuckles)
The Web Warrior Guide to Web Design Technologies
1 Javascrbipt Intro Javascript (or js) is a programming language. Interpreted, not compiled. Not the same as java, but, similar. Use tags to use. Object-oriented.
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.
CS 299 – Web Programming and Design Overview of JavaScript and DOM Instructor: Dr. Fang (Daisy) Tang.
Introduction to scripting
PHP: Hypertext Processor Fred Durao
4.1 JavaScript Introduction
Server vs Client-side validation. JavaScript JavaScript is an object-based language. JavaScript is based on manipulating objects by modifying an object’s.
JavaScript, Fifth Edition Chapter 1 Introduction to JavaScript.
Chapter 5 Java Script And Forms JavaScript, Third Edition.
 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.
SEG3210 DHTML Tutorial. DHTML DHTML is a combination of technologies used to create dynamic and interactive Web sites. –HTML - For creating text and image.
Bridges To Computing General Information: This document was created for use in the "Bridges to Computing" project of Brooklyn College. You are invited.
SYST Web Technologies SYST Web Technologies Lesson 6 – Intro to JavaScript.
1 JavaScript. 2 What’s wrong with JavaScript? A very powerful language, yet –Often hated –Browser inconsistencies –Misunderstood –Developers find it painful.
DHTML: Dynamic HTML Internet Technology1. What is DHTML? A collection of enhancements to HTML ► To create dynamic and interactive websites Combination.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
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,
Javascript. Outline Introduction Fundamental of JavaScript Javascript events management DOM and Dynamic HTML (DHTML)
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
Tutorial 10 Programming with JavaScript
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
Client-Side Scripting JavaScript.  produced by Netscape for use within HTML Web pages.  built into all the major modern browsers. properties  lightweight,
Introduction.  The scripting language most often used for client-side web development.  Influenced by many programming languages, easier for nonprogrammers.
JavaScript Syntax and Semantics. Slide 2 Lecture Overview Core JavaScript Syntax (I will not review every nuance of the language)
Dr. Qusai Abuein1 Internet & WWW How to program Chap.(6) JavaScript:Introduction to Scripting.
JavaScript Syntax, how to use it in a HTML document
JavaScript - Basic Concepts Prepared and Presented by Hienvinh Nguyen, Afshin Tiraie.
JavaScript Scripting language What is Scripting ? A scripting language, script language, or extension language is a programming language.
XP Tutorial 8 Adding Interactivity with ActionScript.
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.
COP 3813 Intro to Internet Computing Prof. Roy Levow Lecture 4 JavaScript.
JavaScript Defined DOM (Document Object Model) General Syntax Body vs. Head Variables Math & Logic Selection Functions & Events Loops Animation Getting.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
Introduction to JavaScript CSc 2320 Fall 2014 Disclaimer: All words, pictures are adopted from “Simple JavaScript”by Kevin Yank and Cameron Adams and also.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
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.
CGS 3066: Web Programming and Design Spring 2016 Introduction to JavaScript.
REEM ALMOTIRI Information Technology Department Majmaah University.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
 2001 Prentice Hall, Inc. All rights reserved. Outline 1 JavaScript.
Introduction to JavaScript MIS 3502, Fall 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 9/29/2016.
Chapter 6 JavaScript: Introduction to Scripting
Tutorial 10 Programming with JavaScript
Barb Ericson Georgia Institute of Technology May 2006
JavaScript Syntax and Semantics
4. Javascript Pemrograman Web I Program Studi Teknik Informatika
Introduction to JavaScript
JavaScript an introduction.
DHTML Javascript Internet Technology.
A second look at JavaScript
WEB PROGRAMMING JavaScript.
DHTML Javascript Internet Technology.
T. Jumana Abu Shmais – AOU - Riyadh
Introduction to JavaScript
Tutorial 10: Programming with javascript
Web Programming and Design
Presentation transcript:

Javascript It’s not JAVA

What do these all have in common?

Take a deep breath … Enjoy the ride Learned? Sysadmin? html? CSS? Learned how to learn? Now a new language … Hold your hands in the air and scream?

Javascript Program dynamic web interactions Scripting language Interpreted at runtime–by the browser Can change on the fly Resources Ch 6-11, and 13 of Deitel and Deitel Website w3schools.com

Why? html = content CSS = appearance Scripting = behavior React to events Manipulate and validate data Add dynamic functionality Read and write HTML

Depth? Issues of style This class is just syntax Teach yourself

Do and learn Open Linux/gedit or Win/Notepad++ Create a dummy header Save as “test.html” Open “test.html” in your favorite browser Refresh as necessary (Ctrl-R) Alt: Open a console in Firefox Firebug or Chrome Inspector to try out the examples as they are presented.

Examples Playing with JavaScript document.write(" " + Date() + " "); Demos available at jsDemosjsDemos

Sample Scripts are created by Certain attributes expect javascript as value Home

JavaScript embedded in html

User interaction Alerts What &nbsp Time is it? Forms Parameter Checking (though increasingly this is being pushed to HTML in HTML5)

Syntax Similar to JAVA Statements end with ; /* comment */ Object.property Escape character is \  Example: \” Etc. No variable types – just declare them like var age = 18; var introText = "A long, long time ago...";

JavaScript as embedded code Can be a lengthy program

<!-- var name; // string entered by the user // read the name from the prompt box as a string name = window.prompt( "Please enter your name", " Type name here" ); document.writeln( " Hello " + name + ", welcome to JavaScript programming! " ); // -->

JavaScript is a complete programming language Arithmetic (D&D ch 6) Decisions/Control (D&D ch7, 8, 13) Functions (D&D ch 9) Arrays, Libraries & Objects (D&D ch ) Input/Output

Mathematical Operators

Relational Operators

Language flow Selection structure if if … else switch Repetition structure while do … while for for … in

Keywords

Functions Format of a function definition function function-name ( parameter-list ) { declarations and statements return expression ; } Function name any valid identifier Parameter list names of variables that will receive arguments  Must have same number as function call  May be empty Declarations and statements  Function body (“block” of code)

Function example document.writeln( " Square the numbers from 1 to 10 " ); // square the numbers from 1 to 10 loop for ( var x = 1; x <= 10; ++x ) // loop document.writeln( "The square of " + x + " is " + square( x ) function call square( x ) + " " ); // function call // The following square function's body is executed // only when the function is explicitly called. definition function square( y ) // square function definition { return y * y; // could also use Math.pow(y, 2.0); for floats }

Software Design Issues Design before code UML etc. Style Whitespace, Indenting, Commenting etc. See D&D ch 6 for recommendations

Much, much more A complete language See refs for more Textbook, D&D ch 6-13 w3schools.coms