Web Development & Design Foundations with HTML5 7th Edition

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

Chapter 08: Adding Adding Interactivity Interactivity With With Behaviors Behaviors By Bill Bennett Associate Professor MSJC CIS MVC.
The Web Warrior Guide to Web Design Technologies
Chapter 7 © 2001 by Addison Wesley Longman, Inc. 1 Chapter 7 Sebesta: Programming the World Wide Web.
JavaScript Describe common uses of JavaScript in Web pages.
Computer Science 103 Chapter 4 Advanced JavaScript.
JavaScript 101 Lesson 5: Introduction to Events. Lesson Topics Event driven programming Events and event handlers The onClick event handler for hyperlinks.
Chapter 9 Introduction to the Document Object Model (DOM) JavaScript, Third Edition.
Web Development & Design Foundations with XHTML Chapter 14 Key Concepts.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 14 Key Concepts 1 Copyright © Terry Felke-Morris.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 14 Key Concepts 1 Copyright © Terry Felke-Morris.
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.
Introduction to JavaScript Dr. John P. Abraham University of Texas – Pan American.
McGraw-Hill/Irwin © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Dynamic Action with Macromedia Dreamweaver MX Barry Sosinsky Valda Hilley.
JavaScript Defined DOM (Document Object Model) General Syntax Body vs. Head Variables Math & Logic Selection Functions & Events Loops Animation Getting.
Event Handlers CS101 Introduction to Computing. Learning Goals Learn about event handlers Determine how events are useful in JavaScript Discover where.
Bridges To Computing General Information: This document was created for use in the "Bridges to Computing" project of Brooklyn College. You are invited.
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.
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.
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.
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.
An Introduction to JavaScript Summarized from Chapter 6 of “Web Programming: Building Internet Applications”, 3 rd Edition.
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
CO1552 Web Application Development HTML Forms, Events and an introduction to JavaScript.
Client-Side Scripting JavaScript.  produced by Netscape for use within HTML Web pages.  built into all the major modern browsers. properties  lightweight,
JavaScript - A Web Script Language Fred Durao
JavaScript, jQuery, and Mashups Incorporating JavaScript, jQuery, and other Mashups into existing pages.
Lecture 10 JavaScript: DOM and Dynamic HTML Boriana Koleva Room: C54
Cs332a_chapt10.ppt CS332A Advanced HTML Programming DHTML Dynamic Hypertext Markup Language A term describing a series of technologies Not a stand-a-lone.
Scott Marino MSMIS Summer Session Web Site Design and Authoring Session 8 Scott Marino.
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.
Making dynamic pages with javascript Lecture 1. Java script java versus javascript Javascript is a scripting language that will allow you to add real.
JavaScript Defined DOM (Document Object Model) General Syntax Body vs. Head Variables Math & Logic Selection Functions & Events Loops Animation Getting.
CIS 3.5 Lecture 2.3 "Introduction to JavaScript".
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 14 Key Concepts 1 Copyright © Terry Felke-Morris.
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:
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.
CHAPTER 10 JAVA SCRIPT.
Using DHTML to Enhance Web Pages
Web Development & Design Foundations with HTML5
Web Development & Design Foundations with HTML5 8th Edition
Parts of Chapter 14 Key Concepts
JavaScript is a programming language designed for Web pages.
Section 17.1 Section 17.2 Add an audio file using HTML
JAVASCRIPTS AND HTML DOCUMENTS
Web Development & Design Foundations with HTML5 7th Edition
14 A Brief Look at JavaScript and jQuery.
Introduction to JavaScript
JavaScript Introduction
DHTML Javascript Internet Technology.
Integrating JavaScript and HTML
Events Comp 205 Fall 2017.
DHTML Javascript Internet Technology.
CHAPTER 7 JavaScripts & HTML Documents
Introduction to JavaScript
Web Development & Design Foundations with H T M L 5
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)
Web Programming and Design
Presentation transcript:

Web Development & Design Foundations with HTML5 7th Edition Chapter 14 Key Concepts Copyright © Terry Felke-Morris

What is JavaScript? Object-based scripting language Works with the objects associated with a Web page document the window the document the elements such as forms, images, hyperlinks, etc.

What is JavaScript? Originally developed by Netscape Named LiveScript Netscape & Sun Microsystems Collaboration LiveScript renamed JavaScript JavaScript is NOT Java

Common Uses of JavaScript Display a message box Select list navigation Edit and validate form information Create a new window with a specified size and screen position Image Rollovers Status Messages Display Current Date Calculations

Common Uses of JavaScript Display information based on the time of the day JavaScript can check the computer's clock and pull the appropriate data based on the clock information. Detect the visitor's browser JavaScript can be used to detect the visitor's browser, and load another page specifically designed for that browser. Control Browsers JavaScript can open pages in customized windows, where you specify if the browser's buttons, menu line, status line or whatever should be present. Validate forms data JavaScript can be used to validate form data at the client-side saving both the precious server resources and time. Create Cookies JavaScript can store information on the visitor's computer and retrieve it automatically next time the user visits your page. Add interactivity to your website JavaScript can be set to execute when something happens, like when a page has finished loading or when a user clicks on a button. Change page contents dynamically JavaScript can randomly display content without the involvement of server programs. It can read and change the content of an HTML elements or move them around pages.

Coding JavaScript JavaScript statements can be coded on a web page using two different techniques: Place JavaScript code between <script> tags Place JavaScript code as part of an event attached to an HTML element

JavaScript: Using The script Element A container tag May be placed in either the head or the body section of a web page <script type="text/javascript"> <!- - alert("Welcome to Our Site"); // - -> </script>

Hands-on practice 14.1 Page 562 chapter14/alert.html

Document Object Model (DOM) A portion of the DOM is shown at the left. Defines every object and element on a web page Hierarchical structure Accesses page elements and apply styles to page elements

An object is a thing or entity. Browser window Submit button Web page document

Property A property is a characteristic or attribute of an object. The background color of a web page document document.bgcolor The date the web page file was last modified document.lastmodified The src file of an image object image1.src

Method A method is an action (a verb) Writing text to a web page document document.write() Submitting a form form1.submit()

Hands-on practice 14.2 Page 566 chapter14/documentwrite.html

JavaScript and Events Events: actions taken by the web page visitor clicking (onclick), placing the mouse on an element (onmouseover), removing the mouse from an element (onmouseout), loading the page (onload), unloading the page (onunload), etc.

Events Event Event Handler click onclick load onload mouseover onmouseover mouseout onmouseout submit onsubmit unload onunload

Hands-on practice 14.3 Page 568 chapter14/mouseovertest.html

JavaScript and Events JavaScript can be configured to perform actions when events occur. The event name is coded as an attribute of an HTML tag The value of the event attribute contains the JavaScript code Example: Display an alert box when the mouse is placed over a hyperlink. <a href="home.htm" onmouseover="alert('Click to go home')">Home</a>

JavaScript Debugging(1) Check the syntax of the statements Pay very close attention to upper and lower case letters, spaces, and quotations Verify that you have saved the page with your most recent changes Verify that you are testing the most recent version of the page (refresh or reload the page) If you get an error message, use the error messages that are displayed by the browser In Firefox: Select Tools > Error Console

JavaScript Debugging(2) Use the Firefox browser: Select Tools > Error Console from the Menu The Error Console will indicate an issue and the line number This may not be exactly where the problem is Sometimes the error is a one or two lines above the indicated line number.

Variable var userName; A variable is a placeholder for information. The variable is stored in the computer’s memory (RAM). var userName; userName = "Karen"; document.write(userName);

Hands-on practice 14.4 Page 570 chapter14/variablewrite.html Page 571

Prompts prompt() method Displays a message and accepts a value from the user myName = prompt(“prompt message”); The value typed by the user is stored in the variable myName

Hands-on practice 14.5 Page 572 chapter14/variablewrite3.html chapter14/changebackground.html