Introduction to JavaScript

Slides:



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

Introduction to JavaScript
The Web Warrior Guide to Web Design Technologies
Web Page Behavior IS 373—Web Standards Todd Will.
Chapter 9 Introduction to the Document Object Model (DOM) JavaScript, Third Edition.
Web Development & Design Foundations with XHTML Chapter 14 Key Concepts.
Introduction to JavaScript. Aim To enable you to write you first JavaScript.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 14 Key Concepts 1 Copyright © Terry Felke-Morris.
Javascript and the Web Whys and Hows of Javascript.
4.1 JavaScript Introduction
JavaScript and The Document Object Model MMIS 656 Web Design Technologies Acknowledgements: 1.Notes from David Shrader, NSU GSCIS 2.Some material adapted.
Introduction to JavaScript Dr. John P. Abraham University of Texas – Pan American.
CS346 - Javascript 1, 21 Module 1 Introduction to JavaScript CS346.
SEG3210 DHTML Tutorial. DHTML DHTML is a combination of technologies used to create dynamic and interactive Web sites. –HTML - For creating text and image.
Event Handlers CS101 Introduction to Computing. Learning Goals Learn about event handlers Determine how events are useful in JavaScript Discover where.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
JavaScript Part 1.
JavaScript 1. What is JavaScript? JavaScript allows web authors to create dynamic pages that react to user interaction. It is an Object-based because.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 14 Key Concepts 1 Copyright © Terry Felke-Morris.
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,
Lesson13. JavaScript JavaScript is an interpreted language, designed to function within a web browser. It can also be used on the server.
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
Introduction to JavaScript 41 Introduction to Programming the WWW I CMSC Winter 2004 Lecture 17.
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 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.
By Tharith Sriv. To write a web page you use: HHTML (HyperText Markup Language), AASP (Active Server Page), PPHP (HyperText Preprocessor), JJavaScript,
JavaScript Introduction.  JavaScript is a scripting language  A scripting language is a lightweight programming language  A JavaScript can be inserted.
1 CSC160 Chapter 7: Events and Event Handlers. 2 Outline Event and event handlers onClick event handler onMouseOver event handler onMouseOut event handler.
JavaScript Overview Developer Essentials How to Code Language Constructs The DOM concept- API, (use W3C model) Objects –properties Methods Events Applications;
 Web pages originally static  Page is delivered exactly as stored on server  Same information displayed for all users, from all contexts  Dynamic.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 14 Key Concepts 1 Copyright © Terry Felke-Morris.
Web Programming Overview. Introduction HTML is limited - it cannot manipulate data How Web pages are extended (include): –Java: an object-oriented programming.
Javascript Basic Concepts Presentation By: Er. Sunny Chanday Lecturer CSE/IT RBIENT.
JavaScript and Ajax (JavaScript Environment) Week 6 Web site:
Web Programming Java Script-Introduction. What is Javascript? JavaScript is a scripting language using for the Web. JavaScript is a programming language.
Copyright © Terry Felke-Morris Web Development & Design Foundations with HTML5 8 th Edition CHAPTER 14 KEY CONCEPTS 1 Copyright.
Section 10.1 Define scripting
Introduction to.
CGS 3066: Web Programming and Design Spring 2017
Module 1 Introduction to JavaScript
JavaScripts.
Applied Component I Unit II Introduction of java-script
“Under the hood”: Angry Birds Maze
Web Development & Design Foundations with HTML5
JavaScript is a programming language designed for Web pages.
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Section 17.1 Section 17.2 Add an audio file using HTML
Web Development & Design Foundations with HTML5 7th Edition
4. Javascript Pemrograman Web I Program Studi Teknik Informatika
JavaScript for Beginners
14 A Brief Look at JavaScript and jQuery.
Introduction to JavaScript
JavaScript Introduction
DHTML Javascript Internet Technology.
Events Comp 205 Fall 2017.
DHTML Javascript Internet Technology.
Tutorial 10: Programming with javascript
JavaScript Basics What is JavaScript?
JavaScript is a scripting language designed for Web pages by Netscape.
Introduction to Programming and JavaScript
JavaScript and Ajax (JavaScript Events)
CNIT 133 Interactive Web Pags – JavaScript and AJAX
JavaScript for Beginners
Introduction to JavaScript
JavaScript for Beginners
Brief Look InTo JavaScript
Presentation transcript:

Introduction to JavaScript Dr. John P. Abraham University of Texas – Pan American

What is JavaScript Object-based scripting language Developed by Sun Microsystems Syntax is similar to C++ HTML is static, JavaScript adds interactivity. JavaScript can store information as cookies.

SCRIPTING LANGAUGES Programming languages developed to serve a particular purpose. JAVA SCRIPT was developed to add interactivity to Web pages Interpreted rather than compiled Interpreter is built into the web browsers First made available as part of Netscape 2.0

Flavors of Java Script Core Client side Server side Basic Java script language. It includes the operators control structures and built-in functions. Client side Server side

Client side javascript Extends the core to provide access to browser and documents via DOM (document Object Model). Runs on the client’s (visitor) computer. Example an image on the web page can be manipulated by JavaScript, we can change its source property (src) to display a different image in response to something the user is doing such as moving the mouse. Javascript can be used to create cookies and read from it. Also can be used for form validation saving time for a response from the server.

Popular Uses for JavaScript Rollovers, status bar messages, browser detection, redirecting the visitor, random images and quotes, pop-up windows, form validations, loading multiple frames at once, cookies, slide shows, calculations, plug-in detection, random sounds, cycling banners, displaying current date, displaying last modified date, etc.

Server side Provides access to databases and converts results into HTML format and delivers to the browser.

Other approaches to making web interactive Common Gateway Interface, CGI Java applets, Client pull (eg <meta http-equiv=“refresh” content = “7”> reload every 7 sec. Server push. (server maintains the connection and delivers additional data over a period of time) Plug-ins (adds animation and interactivity) Various other scripting languages

JavaScript and HTML HTML tag attributes can be accessed as object properties with javaScript. Document.write(“Hello”)

Example <html> <head> <title>Script 1.1: Using the Write Method</title> </head> <body bgcolor="white" text="black"> <script language="JavaScript" type="text/javascript"> document.write("Hello") </script> </body> </html>

Example 2 <html> <head> <title>Script 1.3: Changing Background & Foreground Colors</title> </head> <body bgcolor="white" text="black"> <script language="JavaScript" type="text/javascript"> document.write("<h1 align=center>Hello</h1>") document.bgColor = "blue" document.fgColor = "white" </script> </body> </html>

Script in HTML head <script type = “text/javascript”> says it a text file and the scripting language is javaScript <!— Those browsers that do not support script will consider this as comments and ignore SCRIPT CODE HERE // 

Document Object The most import object in JavaScript is the document object To refer to a method for this object we write: document.write(“hello”) document.write(“<h1 align=center> hello”</h1>”) document.bgColor = “blue”

Obtaining user input with prompt dialog After <script – declare variables Var visitorName Read it this way: vistorName=window.prompt(“Please enter your name”); Display it Document.writeln(“Hello, “ + name)

Arithmatic + - * / %

Examine properties Document.write (“appName: “, navigator.appName); Microsoft explorer Document.write(“Window location: “,window.location) File:///A:/script.html Document.write(“history: “, window.history.length) Length: 1

Netscape Navigator Can execute javascript directly by typing (in the browser area) javascript: location.href Shows the url

The Event Model Most popularly capture events Load – finishes loading a page Unload – loads a new one Mouseover – mouse moved Mouseout – move mouse off of object Click Focus – make active an object Change – changes data selected Submit – submits a form Reset – resets a form Event handlers are onLoad, onClick, onChange, etc. http://members.ozemail.com.au/~dcrombie/javascript/chap07.html

First JavaScript program <html> <head> <title>Reporting Browser Information</title> </head> <body> <h1>Your Browser</h1> <script language = "JavaScript" type ="text/javascript"> document.write("<b>appCodeName:</b> ", navigator.appCodeName, "<br>") document.write("<b>appName:</b> ", navigator.appName, "<br>") document.write("<b>appVerson:</b> ", navigator.appVersion, "<br>") document.write("<b>Platform:</b> ", navigator.platform, "<br>") </script> </body> </html>