Project Two Adding Scrolling Messages! Page 2.4 to 2.18 Today’s Agenda Look at scrolling message coding. Create a web page with a text box. Create a web.

Slides:



Advertisements
Similar presentations
The Web Warrior Guide to Web Design Technologies
Advertisements

Georgia Institute of Technology JavaScript part 2 Barb Ericson Georgia Institute of Technology May 2006.
CIS101 Introduction to Computing Week 12. Agenda Your questions Solutions to practice text Final HTML/JavaScript Project Copy and paste assignment JavaScript:
HTML Comprehensive Concepts and Techniques Second Edition Project 8 Integrating JavaScript with HTML.
1 A Balanced Introduction to Computer Science, 2/E David Reed, Creighton University ©2008 Pearson Prentice Hall ISBN Chapter 7 Event-Driven.
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.
Introduction to JavaScript. Aim To enable you to write you first JavaScript.
Lesson 8 Creating Forms with JavaScript
Chapter 12 Creating and Using XML Documents HTML5 AND CSS Seventh Edition.
JQuery CS 268. What is jQuery? From their web site:
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.,
1 CS 21A Beginning JavaScript Programming Project 2 Creating Pop-up Windows, Adding Scrolling Messages, and Validating Forms Sonny Huang.
Did someone say Music? November 7, Adding MUSIC to a web page: 1. Find your music! 2. A good website is 3. You will.
Copyright 2007, Information Builders. Slide 1 Maintain & JavaScript: Two Great Tools that Work Great Together Mark Derwin and Mark Rawls Information Builders.
McGraw-Hill/Irwin © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Dynamic Action with Macromedia Dreamweaver MX Barry Sosinsky Valda Hilley.
Event Handlers CS101 Introduction to Computing. Learning Goals Learn about event handlers Determine how events are useful in JavaScript Discover where.
Chapter 10 Creating Pop-Up Windows, Adding Scrolling Messages, and Validating Forms HTML5 & CSS 7 th Edition.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 1B Introduction (Tutorial)
Intro to JavaScript. Use the tag to tell the browser you are writing JavaScript.
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.
Integrating JavaScript and HTML5 HTML5 & CSS 7 th Edition.
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.
Writing a JavaScript User-Defined Function  A function is JavaScript code written to perform certain tasks repeatedly  Built-in functions.
Dynamic Web Pages & JavaScript. Dynamic Web Pages Dynamic = Change Dynamic Web Pages are web pages that change. More than just moving graphics around.
Ch. 8 Web Page Design – Animation and Behaviors Mr. Ursone.
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.
1 JavaScript
JavaScript - Basic Concepts Prepared and Presented by Hienvinh Nguyen, Afshin Tiraie.
An Introduction to JavaScript By: John Coliton Tuesday, November 10, 1998 Center for Teaching and Learning.
Scott Marino MSMIS Summer Session Web Site Design and Authoring Session 8 Scott Marino.
Advanced DOM Builds on last presentation on DOM Allows you to dynamically create elements and position them on a page DOM methods/properties are W3C standard.
Introduction To JavaScript. Putting it Together (page 11) All javascript must go in-between the script tags. All javascript must go in-between the script.
COMP403 Web Design JAVA SCRİPTS Tolgay KARANFİLLER.
CSD 340 (Blum)1 Starting JavaScript Homage to the Homage to the Square.
1 CSC160 Chapter 7: Events and Event Handlers. 2 Outline Event and event handlers onClick event handler onMouseOver event handler onMouseOut event handler.
Introduction into JavaScript Java 1 JavaScript JavaScript programs run from within an HTML document The statements that make up a program in an HTML.
HTML Overview Part 5 – JavaScript 1. Scripts 2  Scripts are used to add dynamic content to a web page.  Scripts consist of a list of commands that execute.
JavaScript Challenges Answers for challenges
Event Handling. Objectives Using event handlers Simulating events Using event-related methods.
Lesson 16. Practical Application 1 We can take advantage of JavaScript and the DOM, to set up a form so that the first text box of a form automatically.
Functions.  Assignment #2 is now due on Wednesday, Nov 25 th  (No Quiz)  Go over the midterm  Backtrack and re-cover the question about tracing the.
Event Handling (the right way). A Simple Web Page Events - Summary The web page looks like this:
Tutorial 11 1 JavaScript Operators and Expressions.
Chapter 5: Intro to Scripting CIS 275—Web Application Development for Business I.
Working with the Window Object JavaScript considers the browser window an object, which it calls the window object.
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 Basic Concepts Presentation By: Er. Sunny Chanday Lecturer CSE/IT RBIENT.
JavaScript 101 Lesson 6: Introduction to Functions.
JavaScript Events. Understanding Events Events add interactivity between the web page and the user Events add interactivity between the web page and the.
CNIT 133 Interactive Web Pags – JavaScript and AJAX Popup Boxes.
JavaScript JavaScript is a programming language that web browsers understand. You can use it to make your web pages interactive by: Responding to user.
Web Programming Java Script-Introduction. What is Javascript? JavaScript is a scripting language using for the Web. JavaScript is a programming language.
COM621: Advanced Interactive Web Development Lecture 6 – JavaScript (cont.)
Client-side (JavaScript) Validation. Associating a function with a click event – Part 1 Use the input tag’s onclick attribute to associate a function.
Section 10.1 Define scripting
Using DHTML to Enhance Web Pages
JavaScript is a programming language designed for Web pages.
Project 9 Creating Pop-up Windows, Adding Scrolling Messages, and Validating Forms.
Section 17.1 Section 17.2 Add an audio file using HTML
Introduction to JavaScript
A second look at JavaScript
Integrating JavaScript and HTML
Functions, Regular expressions and Events
For this assignment, copy and past the XHTML to a notepad file with the .html extension. Then add the code I ask for to complete the problems.
Introduction to JavaScript
JavaScript Basics What is JavaScript?
JavaScript is a scripting language designed for Web pages by Netscape.
Web Programming and Design
Web Programming and Design
Presentation transcript:

Project Two Adding Scrolling Messages! Page 2.4 to 2.18 Today’s Agenda Look at scrolling message coding. Create a web page with a text box. Create a web page with a scrolling message. Review Vocabulary Words. Questions? Pop Quiz?? Tuesday!

Scrolling Message 4 basic components: The display object. The message. The position. The delay.

The display object: It defines where the scrolling message displays, which is in a form text box.

Form Name Beginning tag for a form End tag for a form Text box name Size attribute Hint: When creating the form text box, you must name the form and the text box object.

The message: Is a text string assigned to a variable. The text string is what the user sees when the message displays. var scrollMsg = “Mortgage Rates are at their Lowest!” Variable that string is assigned to. String – text!

The position: Is the starting location in which the message first displays in the display object. var beginPos = 0 beginPos = beginPos + 1 If (beginPos > scrollMsg.length) { beginPos = 0 }

Using an IF Statement!

The delay: The delay is the length of time between when the message ends and when it starts to appear again. We use the setTimeout( ) Method here to make the recursive call to the scrolling message. window.setTimeout(“scrollingMsg( )”, 200) The setTimeout( ) method pauses the scrolling message for 200 milliseconds and then again calls the scrollingMsg function.

Recursion Is a programming technique It is used to call the same function from within the function. Be careful when using a recursive call it can lead to an infinite loop or stack overflows which could lead to malfunction of your web site!

Creating a Form Text Box to Display a Scrolling Message To create a text enter the following code on the next slide.

Open notepad and enter the following: Scrolling Message Code This is an example of creating a text box to display a scrolling message. View the source code. Look, change the number – What happens?

Let’s create a user-defined function for a scrolling message. The scrollingMsg( ) function performs 3 tasks: –It assigns the message. –It checks for end of message. –It assigns the next character in the message to the text box, starting with the beginning of the message, in order to make the message scroll.

Don’t forget to add an Event Handler! Event Handler – Will start the scrolling message when the web page loads. Recall that an event is a user action. When the user clicks a button, an event handler triggers JavaScript code to work! Use onload( ) event handler to start the scrollingMsg( ) function. Place in the tag. <BODY onload = “scrollingMsg( )”

Don’t forget you can use Event Handler for other features!

Open Notepad and enter the following: <!--Hide from old browsers var scrollMsg = "Put your message here!" var msgSpace = " " var beginPos = 0 function scrollingMsg() { document.msgForm.scrollingMsg.value = scrollMsg.substring(beginPos,scrollMsg.length)+msgSpace+ scrollMsg.substring(0,beginPos) beginPos = beginPos + 1 if (beginPos > scrollMsg.length) { beginPos=0 } window.setTimeout("scrollingMsg()",200) } //-->

You should see the following:

Lets Review Vocabulary Words Scrolling Message Scrolling Msg( ) function If Statements Conditional Operators setTimeout( ) recursion

Any Questions

Quiz on Tuesday! Have a great 3-day weekend!