JavaScript Basics What is JavaScript?

Slides:



Advertisements
Similar presentations
JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
Advertisements

The Web Warrior Guide to Web Design Technologies
Multimedia and the World Wide Web HCI 201 Lecture Notes #8B.
Information Technology Center Hany Abdelwahab Computer Specialist.
Javascript and the Web Whys and Hows of Javascript.
JavaScript, Fifth Edition Chapter 1 Introduction to JavaScript.
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.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
DHTML: Dynamic HTML Internet Technology1. What is DHTML? A collection of enhancements to HTML ► To create dynamic and interactive websites Combination.
Dynamic Web Authoring Week3 – Javascript Basic COM311H Zheng, School of C&M, UUJ1.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
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)
Lesson13. JavaScript JavaScript is an interpreted language, designed to function within a web browser. It can also be used on the server.
Client Side Programming with JavaScript Why use client side programming? Web sides built on CGI programs can rapidly become overly complicated to maintain,
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
Introduction.  The scripting language most often used for client-side web development.  Influenced by many programming languages, easier for nonprogrammers.
JavaScript, jQuery, and Mashups Incorporating JavaScript, jQuery, and other Mashups into existing pages.
JavaScript Syntax, how to use it in a HTML document
JavaScript - Basic Concepts Prepared and Presented by Hienvinh Nguyen, Afshin Tiraie.
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.
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.
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.
CIS 3.5 Lecture 2.3 "Introduction to JavaScript".
Introduction to JavaScript MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 2/2/2016.
Javascript Basic Concepts Presentation By: Er. Sunny Chanday Lecturer CSE/IT RBIENT.
Web Programming Java Script-Introduction. What is Javascript? JavaScript is a scripting language using for the Web. JavaScript is a programming language.
 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.
CGS 3066: Web Programming and Design Spring 2017
Module 1 Introduction to JavaScript
Java Script Introduction. Java Script Introduction.
Introduction to Client-Side Scripting and JavaScript
Chapter 6 JavaScript: Introduction to Scripting
“Under the hood”: Angry Birds Maze
Tutorial 10 Programming with JavaScript
Web Development & Design Foundations with HTML5
JavaScript is a programming language designed for Web pages.
Donna J. Kain, Clarkson University
Web Development & Design Foundations with HTML5 7th Edition
4. Javascript Pemrograman Web I Program Studi Teknik Informatika
JavaScript.
14 A Brief Look at JavaScript and jQuery.
Introduction to JavaScript
JavaScript Introduction
JavaScript an introduction.
DHTML Javascript Internet Technology.
Exercises on JavaScript & Revision
A second look at JavaScript
Your 1st Programming Assignment
WEB PROGRAMMING JavaScript.
Events Comp 205 Fall 2017.
DHTML Javascript Internet Technology.
T. Jumana Abu Shmais – AOU - Riyadh
JavaScript What is JavaScript? What can JavaScript do?
Tutorial 10 Programming with JavaScript
JavaScript What is JavaScript? What can JavaScript do?
“Under the hood”: Angry Birds Maze
Introduction to JavaScript
Tutorial 10: Programming with javascript
JavaScript is a scripting language designed for Web pages by Netscape.
Introduction to Programming and JavaScript
Web Programming and Design
Presentation transcript:

JavaScript Basics What is JavaScript? JavaScript is a programming language designed for Web pages.

Why Use JavaScript? JavaScript enhances Web pages with dynamic and interactive features. JavaScript runs in client software. JavaScript 1.3 works with version 4.0 browsers.

What Can JavaScript Do? Common JavaScript tasks can replace server-side scripting. JavaScript enables shopping carts, form validation, calculations, special graphic and text effects, image swapping, image mapping, clocks, and more.

JavaScript Syntax. e.g., document.write("Hello World") Unlike HTML, JavaScript is case sensitive. Dot Syntax is used to combine terms. e.g., document.write("Hello World") Certain characters and terms are reserved. JavaScript is simple text (ASCII).

JavaScript Terminology. JavaScript programming uses specialized terminology. Understanding JavaScript terms is fundamental to understanding the script. Objects, Properties, Methods, Events, Functions, Values, Variables, Expressions, Operators.

Objects Objects refers to windows, documents, images, tables, forms, buttons or links, etc. Objects should be named. Objects have properties that act as modifiers.

Properties e.g., background color is expressed by: document.bgcolor . Properties are object attributes. Object properties are defined by using the object's name, a period, and the property name. e.g., background color is expressed by: document.bgcolor . document is the object. bgcolor is the property.

Methods e.g., document.write(”Hello World") document is the object. Methods are actions applied to particular objects. Methods are what objects can do. e.g., document.write(”Hello World") document is the object. write is the method.

Events e.g., the OnMouseover event handler action can change an image. Events associate an object with an action. e.g., the OnMouseover event handler action can change an image. e.g., the onSubmit event handler sends a form. User actions trigger events.

Functions e.g., function doWhatever () {statement here} Functions are named statements that performs tasks. e.g., function doWhatever () {statement here} The curly braces contain the statements of the function. JavaScript has built-in functions, and you can write your own.

Values Number: 1, 2, 3, etc. String: characters enclosed in quotes. Values are bits of information. Values types and some examples include: Number: 1, 2, 3, etc. String: characters enclosed in quotes. Boolean: true or false. Object: image, form Function: validate, doWhatever

Variables e.g. var month; e.g. var month = April; Variables contain values and use the equal sign to specify their value. Variables are created by declaration using the var command with or without an initial value state. e.g. var month; e.g. var month = April;

Expressions e.g., var month = May; is an expression. Expressions are commands that assign values to variables. Expressions always use an assignment operator, such as the equals sign. e.g., var month = May; is an expression. Expressions end with a semicolon.

Operators Arithmetic operators, such as plus. Operators are used to handle variables. Types of operators with examples: Arithmetic operators, such as plus. Comparisons operators, such as equals. Logical operators, such as and. Control operators, such as if. Assignment and String operators.

Methods of Using JavaScript. 1. JavaScripts can reside in a separate page. 2. JavaScript can be embedded in HTML documents -- in the <head>, in the <body>, or in both. 3. JavaScript object attributes can be placed in HTML element tags. e.g., <body onLoad="alert('WELCOME')">

1. Using Separate JavaScript Files. Linking can be advantageous if many pages use the same script. Use the source element to link to the script file. <script src="myjavascript.js” language="JavaScript1.2” type="text/javascript"> </script>

2. Embedding JavaScript in HTML. When specifying a script only the tags <script> and </script> are essential, but complete specification is recommended: <script language="javascript” type="text/javascript"> <!-- Begin hiding window.location=”index.html" // End hiding script--> </script>

Using Comment Tags HTML comment tags should bracket any script. The <!-- script here --> tags hide scripts in HTML and prevent scripts from displaying in browsers that do not interpret JavaScript. Double slashes // are the signal characters for a JavaScript single-line comment.

3. Using JavaScript in HTML Tags. Event handlers like onMouseover are a perfect example of an easy to add tag script. <a href=”index.html” onMouseover="document.logo.src='js2.gif'" onMouseout="document.logo.src='js.gif'"> <img src="js.gif" name="logo"> </a>

Creating an Alert Message The following script in the <body> tag uses the onLoad event to display an Alert window The message is specified within parenthesis. <body onLoad="alert('WELCOME. Enjoy your visit. Your feedback can improve cyberspace. Please let me know if you detect any problems. Thank you.')">