Javascript Basic Concepts Presentation By: Er. Sunny Chanday Lecturer CSE/IT RBIENT.

Slides:



Advertisements
Similar presentations
Sue Wills July Objects The JavaScript language is completely centered around objects, and because of this, it is known as an Object Oriented Programming.
Advertisements

JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
HTML 5 and CSS 3, Illustrated Complete Unit L: Programming Web Pages with JavaScript.
Lesson 12- Unit L Programming Web Pages with JavaScript.
The Web Warrior Guide to Web Design Technologies
Multimedia and the World Wide Web HCI 201 Lecture Notes #8B.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
Tutorial 10 Programming with JavaScript
Information Technology Center Hany Abdelwahab Computer Specialist.
JavaScript 101 Lesson 5: Introduction to Events. Lesson Topics Event driven programming Events and event handlers The onClick event handler for hyperlinks.
Introduction to scripting
1 Events Lect 8. 2 Event-driven Pages one popular feature of the Web is its interactive nature e.g., you click on buttons to make windows appear e.g.,
Javascript and the Web Whys and Hows of Javascript.
WEB DESIGN AND PROGRAMMING Introduction to Javascript.
JavaScript An Introduction.
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.
SEG3210 DHTML Tutorial. DHTML DHTML is a combination of technologies used to create dynamic and interactive Web sites. –HTML - For creating text and image.
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.
Database-Driven Web Sites, Second Edition1 Chapter 3 INTRODUCTION TO CLIENT-SIDE SCRIPTS.
JavaScript Part 1.
1 CLIENT-SIDE SCRIPTS. Objectives 2 Learn how to reference objects in HTML documents using the HTML DOM and dot syntax Learn how to create client-side.
JavaScript 1. What is JavaScript? JavaScript allows web authors to create dynamic pages that react to user interaction. It is an Object-based because.
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.
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,
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.
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,
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
1 JavaScript in Context. Server-Side Programming.
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.
20-753: Fundamentals of Web Programming 1 Lecture 12: Javascript I Fundamentals of Web Programming Lecture 12: Introduction to Javascript.
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.
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.
1 Server versus Client-Side Programming Server-SideClient-Side.
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.
Java Script About Java Script Document Object Model Incorporating JavaScript Adding JavaScript to HTML Embedding a Javascript External Scripts Javascript.
JavaScript. JavaScript Introduction JavaScript is the world's most popular programming language. It is the language for HTML and the web, for servers,
Understanding JavaScript and Coding Essentials Lesson 8.
JavaScript and Ajax (JavaScript Environment) Week 6 Web site:
JAVASCRIPT A quick review. True False ■The DOM is a standardized way of referring to parts of a Web page. ■TRUE ■In the DOM, attributes have their own.
REEM ALMOTIRI Information Technology Department Majmaah University.
 2001 Prentice Hall, Inc. All rights reserved. Outline 1 JavaScript.
Java Script Introduction. Java Script Introduction.
Programming Web Pages with JavaScript
Unit M Programming Web Pages with
Chapter 6 JavaScript: Introduction to Scripting
“Under the hood”: Angry Birds Maze
JavaScript is a programming language designed for Web pages.
Unit M Programming Web Pages with
JavaScript.
DHTML Javascript Internet Technology.
WEB PROGRAMMING JavaScript.
DHTML Javascript Internet Technology.
“Under the hood”: Angry Birds Maze
Tutorial 10: Programming with javascript
JavaScript Basics What is JavaScript?
JavaScript is a scripting language designed for Web pages by Netscape.
Web Programming and Design
Presentation transcript:

Javascript Basic Concepts Presentation By: Er. Sunny Chanday Lecturer CSE/IT RBIENT

JavaScript 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. 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.

Each element on an HTML page linking to its parent in the DOM

The DOM tree, including the document node

Text Nodes

Attribute Nodes

Accessing the Nodes Finding an Element by ID Finding Elements by Tag Name Examples: ⋮

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 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 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 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 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 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 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 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 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, in the, or in both. 3. JavaScript object attributes can be placed in HTML element tags. e.g.,

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">

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

Using Comment Tags HTML comment tags should bracket any script. The 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'">

Creating an Alert Message The following script in the tag uses the onLoad event to display an Alert window The message is specified within parenthesis.