1 Goals and Objectives Goals Goals Understand how JavaScript makes it possible to interact with web pages, minimizes client/server traffic, enables verification.

Slides:



Advertisements
Similar presentations
17 HTML, Scripting, and Interactivity Section 17.1 Add an audio file using HTML Create a form using HTML Add text boxes using HTML Add radio buttons and.
Advertisements

Java Script Session1 INTRODUCTION.
The Web Warrior Guide to Web Design Technologies
1 Topic 6 Processing Form Input. 2Outline Goals and Objectives Goals and Objectives Chapter Headlines Chapter Headlines Introduction Introduction Form.
NAMEd anchors Enabling users to jump to specific points within Web documents.
JavaScript: Introduction to Handling Events 20 th April 2011.
Macromedia Dreamweaver 4 Advanced Level Course. Add Rollovers Rollovers or mouseovers are possibly the most popular effects used in designing Web pages.
Handling Events II 27th April Introduction Event Model Events Event Handling Navigation Events On-the-Fly Web Pages Web-Page Context Nesting On-the-Fly.
JavaScript 101 Lesson 5: Introduction to Events. Lesson Topics Event driven programming Events and event handlers The onClick event handler for hyperlinks.
NAMEd anchors Enabling users to jump to specific points within Web documents.
Web Development & Design Foundations with XHTML Chapter 14 Key Concepts.
Web Development & Design Foundations with XHTML Chapter 9 Key Concepts.
ASP.NET Programming with C# and SQL Server First Edition
CST JavaScript Validating Form Data with JavaScript.
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
JS: DOM Form Form Object Form Object –The Form object represents an HTML form. –For each instance of a tag in an HTML document, a Form object is created.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
CNIT 133 Interactive Web Pags – JavaScript and AJAX Event and Event Handling.
JavaScript and The Document Object Model MMIS 656 Web Design Technologies Acknowledgements: 1.Notes from David Shrader, NSU GSCIS 2.Some material adapted.
Server vs Client-side validation. JavaScript JavaScript is an object-based language. JavaScript is based on manipulating objects by modifying an object’s.
Chapter 5 Java Script And Forms JavaScript, Third Edition.
Chapter 6: Forms JavaScript - Introductory. Previewing the Product Registration Form.
© Cheltenham Computer Training 2001 Macromedia Dreamweaver 4 - Slide No 1 Macromedia Dreamweaver 4 Advanced Level Course.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
Event Handlers CS101 Introduction to Computing. Learning Goals Learn about event handlers Determine how events are useful in JavaScript Discover where.
WEEK 3 AND 4 USING CLIENT-SIDE SCRIPTS TO ENHANCE WEB APPLICATIONS.
JavaScript II ECT 270 Robin Burke. Outline JavaScript review Processing Syntax Events and event handling Form validation.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
JavaScript Part 1.
JSP Java Server Pages Softsmith Infotech.
Adding User Interactivity – Lesson 51 Adding User Interactivity Lesson 5.
CSS Class 7 Add JavaScript to your page Add event handlers Validate a form Open a new window Hide and show elements Swap images Debug JavaScript.
Web Programming: Client/Server Applications Server sends the web pages to the client. –built into Visual Studio for development purposes Client displays.
Section 17.1 Add an audio file using HTML Create a form using HTML Add text boxes using HTML Add radio buttons and check boxes using HTML Add a pull-down.
Lecture # 6 Forms, Widgets and Event Handling. Today Questions: From notes/reading/life? Share Personal Web Page (if not too personal) 1.Introduce: How.
Using Client-Side Scripts to Enhance Web Applications 1.
Introduction to JavaScript 41 Introduction to Programming the WWW I CMSC Winter 2004 Lecture 17.
JavaScript, Fourth Edition Chapter 5 Validating Form Data with JavaScript.
CO1552 Web Application Development HTML Forms, Events and an introduction to JavaScript.
Web Development & Design Foundations with XHTML Chapter 9 Key Concepts.
JavaScript - A Web Script Language Fred Durao
Lecture 10 JavaScript: DOM and Dynamic HTML Boriana Koleva Room: C54
HTML Form Widgets. Review: HTML Forms HTML forms are used to create web pages that accept user input Forms allow the user to communicate information back.
Dr. Qusai Abuein1 Internet & WWW How to program Chap.(6) JavaScript:Introduction to Scripting.
Chapter 14: Dynamic HTML: Event Model Presented by: Colbie Brown CS340 Java Web Development Dr. Gloria Carter Love.
Internet & World Wide Web How to Program, 5/e. © by Pearson Education, Inc. All Rights Reserved.
Chapter 2: Variables, Functions, Objects, and Events JavaScript - Introductory.
Introduction to JavaScript Objects, Properties, Methods.
Review of the DOM Node properties and methods Some ways of accessing nodes Appending, copying and removing nodes Event handling – Inline – Scripting –
1 Chapter 3 – JavaScript Outline Introduction Flowcharts Control Structures if Selection Structure if/else Selection Structure while Repetition Structure.
1 CSC160 Chapter 7: Events and Event Handlers. 2 Outline Event and event handlers onClick event handler onMouseOver event handler onMouseOut event handler.
WDMD 170 – UW Stevens Point 1 WDMD 170 Internet Languages eLesson: Variables, Functions and Events (NON-Audio version) © Dr. David C. Gibbs WDMD.
 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.
7. JavaScript Events. 2 Motto: Do you think I can listen all day to such stuff? –Lewis Carroll.
JS DOM. Introduction An HTML page is rendered (painted) in a browser The browser assembles all the elements (objects) contained in the HTML page To create.
Document Object Model Nasrullah. DOM When a page is loaded,browser creates a Document Object Model of the Page.
JavaScript Event Handlers. Introduction An event handler executes a segment of a code based on certain events occurring within the application, such as.
JavaScript and Ajax (JavaScript Environment) Week 6 Web site:
HTML Tutorial. What is HTML HTML is a markup language for describing web documents (web pages) HTML documents are described by HTML tags Each HTML tag.
XHTML Forms.
Chapter 5 Validating Form Data with JavaScript
JavaScript and HTML Simple Event Handling 11-May-18.
Section 17.1 Section 17.2 Add an audio file using HTML
Web Development & Design Foundations with HTML5 7th Edition
JavaScript and HTML Simple Event Handling 19-Sep-18.
CHAPTER 6 EVENTS. CHAPTER 6 EVENTS WHAT IS AN EVENT?
JavaScript and HTML Simple Event Handling 26-Aug-19.
JavaScript and HTML Simple Event Handling 4-Oct-19.
Presentation transcript:

1 Goals and Objectives Goals Goals Understand how JavaScript makes it possible to interact with web pages, minimizes client/server traffic, enables verification of user input, and process events generated by the and tags Objectives Objectives Importance of events in web page control Importance of events in web page control Event model Event model Events Events Event handling Event handling and events handling and events handling Web page on-the-fly Web page on-the-fly Disabling XHTML actions Disabling XHTML actions Practice: handle events generated by and tags Practice: handle events generated by and tags

2 Chapter Headlines 1 Introduction 1 Introduction Without JavaScript, your options are limited Without JavaScript, your options are limited 2 Event Model 2 Event Model Full control over web page behavior begins here Full control over web page behavior begins here 3 Events 3 Events Why bother knowing these events? Why bother knowing these events? 4 Event Handling 4 Event Handling We are sure you can handle it We are sure you can handle it 5 Navigation Events 5 Navigation Events Navigate with style Navigate with style

3 Chapter Headlines 6 Web page on-the-fly 6 Web page on-the-fly Web pages can fly too Web pages can fly too 7 Web page Context 7 Web page Context Browsers take it one step at a time Browsers take it one step at a time 8 Nesting Web page on-the-fly 8 Nesting Web page on-the-fly Watch out all these flying zones Watch out all these flying zones 9 Disabling XHTML Actions 9 Disabling XHTML Actions Control what web surfers can do with your web pages Control what web surfers can do with your web pages

4Introduction Events impart ability to interact with web surfers Events impart ability to interact with web surfers Event is an action that occurs as a result of an interaction Event is an action that occurs as a result of an interaction JavaScript due to events and event handling ability minimizes client/server traffic considerably JavaScript due to events and event handling ability minimizes client/server traffic considerably An event handler is the processing of an event to make decisions An event handler is the processing of an event to make decisions Example of interactions that generate events and need event handlers are: Example of interactions that generate events and need event handlers are: Clicking a hyperlink Clicking a hyperlink Clicking a hot spot on an image map Clicking a hot spot on an image map Filling a form Filling a form

5 Event Model Event model is based on interaction between a web surfer and a web page Event model is based on interaction between a web surfer and a web page Events can be classified into two broad groups: Events can be classified into two broad groups: Navigation : clicking on links to browse through web pages Navigation : clicking on links to browse through web pages Filling a form : Entering data and checking form elements Filling a form : Entering data and checking form elements JavaScript event model is based on event object JavaScript event model is based on event object event object connects event source to event handler event object connects event source to event handler When an event occurs, JavaScript sends event object to event handler When an event occurs, JavaScript sends event object to event handler The properties of event object may be: type, target, width, height, layerX, layerY, pageX, pageY,screenX, screenY, data, modifiers, which The properties of event object may be: type, target, width, height, layerX, layerY, pageX, pageY,screenX, screenY, data, modifiers, which

6 Event Model

7

8Events JavaScript has a unique event for each event source JavaScript has a unique event for each event source Event nameEvent SourceEvent handler abortimageonAbort clicktext field/area, listonChange dragDropwindowonDragDrop errorimage, windowonError keyDowndoc, image, linkonKeyDown keyPressdoc, image, linkonKeyPress mouseMovenothingonMouseMove mouseOutlink, image maponMouseOut mouseOverlink, image maponMouseOver resetform reset buttononReset resizewindowonResize submitform submit buttononSubmit

9 Event Handling Event handlers handle and process events Event handlers handle and process events Event handler is included as an attribute of a XHMTL tag Event handler is included as an attribute of a XHMTL tag Event handlers must be enclosed in quotes Event handlers must be enclosed in quotes Handlers are executed first, then XHTML content is rendered Handlers are executed first, then XHTML content is rendered Event handlers can be written as: Event handlers can be written as: Inline script  JavaScript code is included inside XHTML tag Inline script  JavaScript code is included inside XHTML tag Function call  event handlers are written as functions in tag and called from the XHTML tag Function call  event handlers are written as functions in tag and called from the XHTML tag Function call style is better than inline style Function call style is better than inline style

10 Navigation Events Navigation events include: Navigation events include: Clicking a hyperlink Clicking a hyperlink Opening a new URL Opening a new URL Quitting a browser window Quitting a browser window Clicking an hyperlink generates the following events Clicking an hyperlink generates the following events click  when the link is clicked click  when the link is clicked mouseOver  when the mouse is moved over the link mouseOver  when the mouse is moved over the link mouseOut  when the mouse is moved away from the link mouseOut  when the mouse is moved away from the link Loading and unloading web pages are also separate events Loading and unloading web pages are also separate events Appropriate event handling grabs attention of the surfer because it makes the page dynamic Appropriate event handling grabs attention of the surfer because it makes the page dynamic

11

12 Web pages on-the-fly Web pages can be created in two ways Web pages can be created in two ways Using the server Using the server Using the client Using the client Using the server is not recommended as in increases the server traffic Using the server is not recommended as in increases the server traffic Using the client utilizes the concept of creating web page on-the-fly Using the client utilizes the concept of creating web page on-the-fly This concept uses two web pages and the second web page is rendered based on the decision taken for event from the first web page This concept uses two web pages and the second web page is rendered based on the decision taken for event from the first web page Web pages on-the-fly can be used as part of any event handler Web pages on-the-fly can be used as part of any event handler

13

14 Web page Context A web browser can have only one active web page at a time Any code or handlers that the browser needs must be included in the code of active web page The browsers uses web page context to respond to interactions This concept is important when dealing with web pages on-the-fly

15

16

17

18 Disabling XHTML Actions Some XHTML elements have actions associated with them Some XHTML elements have actions associated with them For example: hyperlinks, image maps, and forms For example: hyperlinks, image maps, and forms Without JavaScript, these actions are executed upon clicking Without JavaScript, these actions are executed upon clicking This execution can be made conditional by using event handler functions This execution can be made conditional by using event handler functions If the condition is true execution takes place or else it is stopped If the condition is true execution takes place or else it is stopped

19

20Summary JavaScript interacts with surfers through events and event handlers JavaScript interacts with surfers through events and event handlers Event model is based on event object that connects event source with event handler Event model is based on event object that connects event source with event handler JavaScript has an event for each event source JavaScript has an event for each event source Event handlers are functions that process and handle events Event handlers are functions that process and handle events JavaScript also provides navigation events JavaScript also provides navigation events Web pages can be created on-the-fly on client-side itself Web pages can be created on-the-fly on client-side itself Improper web page context may result in errors Improper web page context may result in errors Web pages on-the-fly can be nested Web pages on-the-fly can be nested XHTML actions can be disabled conditionally XHTML actions can be disabled conditionally