ECA 225 Applied Interactive Programming ECA 225 Applied Online Programming images.

Slides:



Advertisements
Similar presentations
Chapter 16 Dynamic HTML: Data Binding with Tabular Data Control.
Advertisements

Tutorial 5 Windows and Frames Section A - Working with Windows.
Java Script Session1 INTRODUCTION.
The Web Warrior Guide to Web Design Technologies
Chapter 16 Dynamic HTML and Animation The Web Warrior Guide to Web Design Technologies.
Javascript Document Object Model. How to use JavaScript  JavaScript can be embedded into your html pages in a couple of ways  in elements in both and.
 2008 Pearson Education, Inc. All rights reserved Document Object Model (DOM): Objects and Collections.
Web-based Application Development Lecture 13 February 21, 2006 Anita Raja.
JavaScript 101 Lesson 5: Introduction to Events. Lesson Topics Event driven programming Events and event handlers The onClick event handler for hyperlinks.
JavaScript, Third Edition
Chapter 9 Introduction to the Document Object Model (DOM) JavaScript, Third Edition.
The Web Wizard’s Guide To JavaScript Chapter 5 More Image Swapping.
Web Programming Material From Greenlaw/Hepp, In-line/On-line: Fundamentals of the Internet and the World Wide Web 1 Introduction The JavaScript Programming.
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 Defined DOM (Document Object Model) General Syntax Body vs. Head Variables Math & Logic Selection Functions & Events Loops Animation Getting.
 2008 Pearson Education, Inc. All rights reserved Document Object Model (DOM): Objects and Collections.
Creating Web Documents: JavaScript, continued Tool reports Creating new windows Form input verification Homework: read about JavaScript, start planning.
Unobtrusive JavaScript
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
Bill's Amazing Content Rotator jQuery Content Rotator.
ECA 225 Applied Interactive Programming1 ECA 225 Applied Online Programming DOM.
Adding User Interactivity – Lesson 51 Adding User Interactivity Lesson 5.
Lesson13. JavaScript JavaScript is an interpreted language, designed to function within a web browser. It can also be used on the server.
JavaScript, Fourth Edition
Chapter 5: Windows and Frames
Chapter 7: DHTML: Object Model and Collections CIS 275—Web Application Development for Business I.
CSCE 102 – Chapter 9 (Functions and Parameters) CSCE General Applications Programming Benito Mendoza Benito Mendoza 1 By Benito Mendoza.
Modified from Moseley ’s sli desWeb Applications Development. Lecture 3 Slide 1 Lecture 3: Dynamic Web Pages – Introduction to JavaScript Instructor: Dr.
JavaScript Syntax, how to use it in a HTML document
Cs332a_chapt10.ppt CS332A Advanced HTML Programming DHTML Dynamic Hypertext Markup Language A term describing a series of technologies Not a stand-a-lone.
ECA 225 Applied Interactive Programming1 ECA 225 Applied Online Programming basics.
Chapter 2: Variables, Functions, Objects, and Events JavaScript - Introductory.
Internet & World Wide Web How to Program, 5/e. © by Pearson Education, Inc. All Rights Reserved.2 Revised by Dr. T. Tran for CSI3140.
Handling Image & Animation Using JavaScript HTML tag to display image: More options:
JavaScript, Fourth Edition Chapter 4 Manipulating the Browser Object Model.
WDMD 170 – UW Stevens Point 1 WDMD 170 Internet Languages eLesson: Working with Windows (No audio component) © Dr. David C. Gibbs
ECA 225 Applied Interactive Programming ECA 225 Applied Online Programming control structures, events, objects.
JavaScript Defined DOM (Document Object Model) General Syntax Body vs. Head Variables Math & Logic Selection Functions & Events Loops Animation Getting.
Rich Internet Applications 3. Client JavaScript. Document Object Model (DOM) The DOM, is an interface that allows scripts or programs to access and manipulate.
Javascript Overview. What is Javascript? May be one of the most popular programming languages ever Runs in the browser, not on the server All modern browsers.
Introducing DHTML. Goals Understand the concept of DHTML as a tool for creating dynamic content Understand how to use DOM properties to make changes in.
Understanding JavaScript and Coding Essentials Lesson 8.
Tutorial 11 1 JavaScript Operators and Expressions.
Chapter 6 Murach's JavaScript and jQuery, C6© 2012, Mike Murach & Associates, Inc.Slide 1.
Project 3: Understanding the JavaScript Object Model Essentials for Design JavaScript Level One Michael Brooks.
JavaScript Events Java 4 Understanding Events Events add interactivity between the web page and the user You can think of an event as a trigger that.
JavaScript and Ajax (JavaScript Functions) Week 5 Web site:
JavaScript and Ajax (JavaScript Environment) Week 6 Web site:
JavaScript Events. Understanding Events Events add interactivity between the web page and the user Events add interactivity between the web page and the.
Internet & World Wide Web How to Program, 5/e.  JavaScript events  allow scripts to respond to user interactions and modify the page accordingly  Events.
The Web Wizard’s Guide To JavaScript Chapter 4 Image Swapping.
Changing CSS Styles via JavaScript No readings?. 2 Review? You can change the CSS styling of an element with JavaScript Syntax is similar to accessing.
COM621: Advanced Interactive Web Development Lecture 6 – JavaScript (cont.)
The Web Wizard’s Guide To JavaScript
Using DHTML to Enhance Web Pages
Unit M Programming Web Pages with
Programming Games Work / finish and show dice game. Extras. Timed events. ftp. index file. Homework: Catch up and do slide show.
© 2015, Mike Murach & Associates, Inc.
Introduction to JavaScript Events
Web Development & Design Foundations with HTML5 7th Edition
Simplest Rollover (nonJavaScript!)
The Web Wizard’s Guide To JavaScript
Programming the Web using XHTML and JavaScript
Document Object Model (DOM): Objects and Collections
Events Comp 205 Fall 2017.
Working with Special Effects
Functions, Regular expressions and Events
The Web Wizard’s Guide To JavaScript
Graphics Considerations
JavaScript Session III
Presentation transcript:

ECA 225 Applied Interactive Programming ECA 225 Applied Online Programming images

ECA 225 Applied Interactive Programming Review Given these variables: var first_name = “Michael”; var last_name = “Barath”; var feet = 5; var height = 7; What is the code to print the following sentence using the variables? My name is Michael Barath. I am 5’ 7” tall.

ECA 225 Applied Interactive Programming HTTP  client side initiates request  connection to server  server response is to download files, including.jpg or.gif  files stored in browser cache What happens if we have a rollover, where one image is swapped with a second as the mouse rolls over it? If we have not downloaded the second image at the time of the original download, the browser must make another request.

ECA 225 Applied Interactive Programming Image object  When we insert an image into HTML code, we create an image object. creates an Image object whose name is image1 and src is halle.jpg

ECA 225 Applied Interactive Programming Image object cont …  Since we will be using a second image to replace the original image, we must create a second Image object. use the new constructor to create a new Image( ) then assign the src property of the new Image to a file this image is automatically downloaded to the cache Marley = new Image( ); Marley.src = “marley.jpg”;

ECA 225 Applied Interactive Programming Image object cont …  using dot syntax to access the various properties of an Image( ) object to access the width property: to access the src property myWidth = document.image1.width; mySrc = document.image1.src;

ECA 225 Applied Interactive Programming Image object cont …  using dot syntax to change the src of an Image( ) the following code changes the src attribute from its original value of halle.jpg to the src of the Marley object, marley.jpg document.image1.src = Marley.src;

ECA 225 Applied Interactive Programming Image object cont …  to associate a change of images with a mouseOver event event handlers are called from HTML code, so the event handler is placed in HTML code, not inside the tags if you do not want the link to work leave out the href

ECA 225 Applied Interactive Programming Image object cont …  In browsers prior to IE 5+ and Netscape 6: onMouseOver and onMouseOut event handlers must be placed inside tags, not inside the tag swapped images must have the same width and height dimensions

ECA 225 Applied Interactive Programming Image object cont …  to use a function to swap images Halle = new Image( ); Halle.src = ‘halle.jpg’; Marley = new Image( ); Marley.src = ‘marley.jpg’; function swapImages( currentImage ){ document.image1.src = currentImage; }

ECA 225 Applied Interactive Programming Timers  setInterval( )  once called, it automatically fires at specific intervals  not supported by browsers prior to IE4 and NN4  setInterval( ) takes two parameters  the function to be called  the amount of time, in milliseconds, between firings setInterval( function, milliseconds );

ECA 225 Applied Interactive Programming Timers cont … var counter = 1; setInterval( “startTimer( )”, 1000 ); function startTimer( ){ document.form1.counter.value = counter++; }

ECA 225 Applied Interactive Programming Timers cont …  setInterval( ) has a corresponding method named clearInterval( ) which can be used to stop the timer  when setInterval( ) is called it returns a unique ID number  to stop setInterval pass the ID number returned by setInterval( ) to clearInterval( )

ECA 225 Applied Interactive Programming Timers cont … var counter = 1; var myInterval = setInterval( “startTimer( )”, 1000 ); function startTimer( ){ document.form1.counter.value = counter++; } function stopTimer( ){ clearInterval( myInterval ); }

ECA 225 Applied Interactive Programming Timers cont …  setTimeout( )  once called, it fires only one time  to set up a timer that fires more than once, setTimeout( ) must be called again  setTimeout( ) takes two parameters  the function to be called  the amount of time, in milliseconds, until the function is called setTimeout( function, milliseconds );

ECA 225 Applied Interactive Programming Timers cont … var counter = 1; setTimeout( “startTimer( )”, 1000 ); function startTimer( ){ document.form1.counter.value = counter++; setTimeout( “startTimer( )”, 1000 ); }

ECA 225 Applied Interactive Programming Timers cont …  setTimeout( ) has a corresponding method named clearTimeout( ) which can be used to stop the timer  when setTimeout( ) is called it returns a unique ID number  to stop setTimeout pass the ID number returned by setTimeout( ) to clearTimeout( )

ECA 225 Applied Interactive Programming Timers cont … var counter = 1; var myTimeout = setTimeout( “startTimer( )”, 1000 ); function startTimer( ){ document.form1.counter.value = counter++; myTimeout = setTimeout( “startTimer( )”, 1000 ); } function stopTimer( ){ clearTimeout( myTimeout ); }