Javascript Prof. Wenwen Li School of Geographical Sciences and Urban Planning 5644 Coor Hall

Slides:



Advertisements
Similar presentations
JavaScript I. JavaScript is an object oriented programming language used to add interactivity to web pages. Different from Java, even though bears some.
Advertisements

Introducing JavaScript
JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
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
XP 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial 10.
XP Tutorial 1 New Perspectives on JavaScript, Comprehensive1 Introducing JavaScript Hiding Addresses from Spammers.
2012 •••••••••••••••••••••••••••••••••• Summer WorkShop Mostafa Badr
Introduction to scripting
WHAT IS PHP PHP is an HTML-embedded scripting language primarily used for dynamic Web applications.
JavaScript CMPT 281. Outline Introduction to JavaScript Resources What is JavaScript? JavaScript in web pages.
JavaScript, Fifth Edition Chapter 1 Introduction to JavaScript.
Introduction to JavaScript Kirkwood Continuing Education © Copyright 2014, Fred McClurg All Rights Reserved.
Introduction to JavaScript 11 Introduction to Programming the WWW I CMSC Winter 2004 Lecture 14.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
Introduction to JavaScript Gordon Tian
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
CMPS 211 JavaScript Topic 1 JavaScript Syntax. 2Outline Goals and Objectives Goals and Objectives Chapter Headlines Chapter Headlines Introduction Introduction.
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 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
Done by: Hanadi Muhsen1 Tutorial 1.  Learn the history of JavaScript  Create a script element  Write text to a Web page with JavaScript  Understand.
Introduction to PHP Advanced Database System Lab no.1.
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.
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.
JavaScript Scripting language What is Scripting ? A scripting language, script language, or extension language is a programming language.
ECA 225 Applied Interactive Programming1 ECA 225 Applied Online Programming basics.
05 – Java Script (1) Informatics Department Parahyangan Catholic University.
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.
© 2000 – All Rights Reserved - Page 1 Introduction to JavaScript Programming Part One.
4. Javascript M. Udin Harun Al Rasyid, S.Kom, Ph.D Lab Jaringan Komputer (C-307) Desain.
CHAPTER 6 Introduction to PHP5 Part I อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
1 JavaScript in Context. Server-Side Programming.
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.
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
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.
Doktorant ė : Egl ė Mickevi č i ū t ė Software development technologies KAUNO TECHNOLOGIJOS UNIVERSITETAS INFORMACIJOS SISTEM Ų KATEDA Kaunas, 2013.
PHP using MySQL Database for Web Development (part II)
Programming Web Pages with JavaScript
Chapter 6 JavaScript: Introduction to Scripting
Tutorial 10 Programming with JavaScript
JavaScript is a programming language designed for Web pages.
JavaScript Syntax and Semantics
4. Javascript Pemrograman Web I Program Studi Teknik Informatika
JavaScript Introduction
JavaScript an introduction.
Objectives Insert a script element Write JavaScript comments
Your 1st Programming Assignment
WEB PROGRAMMING JavaScript.
PHP.
Tutorial 10 Programming with JavaScript
Tutorial 6 PHP & MySQL Li Xu
JavaScript CS 4640 Programming Languages for Web Applications
Tutorial 10: Programming with javascript
JavaScript Basics What is JavaScript?
JavaScript is a scripting language designed for Web pages by Netscape.
PHP an introduction.
JavaScript CS 4640 Programming Languages for Web Applications
Presentation transcript:

Javascript Prof. Wenwen Li School of Geographical Sciences and Urban Planning 5644 Coor Hall

Outline 1. Overview 2. Function/Application 3. Javascript & HTML & CSS 4. Programming Methods 5. Programming Syntax 6. Javascript Libraries 7. DOM & Javascript

Overview What is Javascript? dynamic programming language client-side scripts Interactive supported prototype-based scripting language multi-paradigm language object-oriented supported

Overview History Beginning was originally developed by Brendan Eich at Netscape Communications Corporation in 10 th, May The named Javascript was adopted in December Standardization ECMAScript in 1997 ECMAScript 2 in 1998 ECMAScript 3 in 1999 ECMAScript 4 in 2007 ECMAScript 5 (ECMAScript 3.1) in 2009 Latest version: ECMAScript 5.1 in 2011 VBScript & JScript

Overview Differences between Javascript and Java Completely different The term “Javascript”: marketing deal Java: full programming language Complied language Stand-alone/web Much harder programming language

Function/Application Web pages development Desktop/mobile platform Web environment Client-side processing

Function/Application Client-side processing & web environment Web pages development Desktop/mobile platform Browser based

Function/Application Differences between Javascript and JSP, ASP, PHP JSP ( JavaServer Pages ): a Java based tool to develop web pages by server- side processing ASP (Active Server Pages): a Microsoft scripting language of server-side processing for dynamic web pages development PHP (PHP: Hypertext Preprocessor): a free scripting language of server-side processing for web pages development but also used as a general-purpose programming language.

Function/Application Differences between Javascript and JSP, ASP, PHP Javascipt: client-side scripting JSP, ASP, PHP: server-side scripting Javascipt: without compiling JSP, ASP, PHP: require compile Javascipt: easy JSP, ASP, PHP: hard Javascipt: low-level security JSP, ASP, PHP: enable security setting

Function/Application Javascript & HTML & CSS HTML tags create objects; JavaScript manipulates those objects. JavaScript enables accessing HTML objects, browser- specific objects and platform-specific objects. * *

Function/Application Javascript & HTML & CSS CSS (Cascading Style Sheets): supports to dsign the appearance of web pages Javascript, HTML and CSS generally are combined for web based development: HTML to define the content of web pages CSS to specify the layout of web pages JavaScript to program the behavior of web pages *

Programming Method Structure Tag: covers JavaScript codes Tag External Javascript

Programming Method Environment Free integrated development environment (IDE) Eclipse NetBeans … Free lightweight editors SciTe Komodo Edit Notepad++ Browsers Firefox Chrome Internet Explorer

Programming Syntax Data type Boolean Float & Double No integer NAN & Infinity string null & undefined

Programming Syntax Program/statement Are separated by semicolons Consists of values, operators, expressions, keywords and comments Values: Fixed values (literals) and variable values (variables) Literals: number, string, expression Variables: Keyword: var Assign values: equal sign Operators assignment operator: = arithmetic operators : + - * /

Programming Syntax Program/statement Keywords: Comments double slashes // between /* and */

Programming Syntax Program/statement White space: enables multiple spaces Case sensitive Line length: less than 80 characters (recommendation) Code blocks: {...} Identifiers: Letters, digits, underscores, and dollar signs. Must begin with a letter, or $ and _. Case sensitive (y and Y are different variables) Avoid reserved words (e.g. keywords)

Programming Syntax Operators Arithmetic operators: Assignment operators:

Programming Syntax Operators String operators & strings and numbers: Difference? x1 = 1 + 2; x2 = “1" + 2; x3 = “JavaScript" + 1; Comparison and logical operators:

Programming Syntax Function Function syntax: Keyword: function Name of function + parentheses () Function names follows the same rules as variables Parameter names separated by commas: (parameter1, parameter2,...) Codes of function are included inside curly brackets: {} Function invocation Function return Return statement Return value

Programming Syntax Object Example: Object: Boeing 787 Properties: airplane.name: Boeing 787 airplane.range: 9,439 miles airplane.topSpeed: 593 mph airplane.wingspan: 197' airplane.cruiseSpeed: 567 mph Method: airplane.landing airplane.takeoff airplane.fly

Javascript Libraries JavaScript Frameworks (Libraries) Reduce the burden of advanced JavaScript programming. jQuery: Prototype: MooTools Content Delivery Networks (CDN): a network of servers containing shared code libraries.

DOM & Javascript HTML DOM (Document Object Model) a standard to access and modify HTML elements. Defines HTML elements as objects Defines properties of HTML elements Defines methods of HTML elements Defines events of HTML elements Method Property

DOM & Javascript Basic methods Access HTML elements:.getElementById.getElementsByTagName().getElementsByClassName() Modify the content of HTML elements: element.innerHTML= element.attribute= element.setAttribute(attribute,value) element.style.property= Modify HTML elements:.createElement().removeChild().appendChild().replaceChild().write()

DOM & Javascript Basic methods Access HTML objects:.anchors.baseURI.body.cookie.documentElement.documentURI …

Conclusion Overview Function/application Javascript & HTML & CSS Programming methods Programming syntax Javascript Libraries DOM & Javascript