JavaScript V Robin Burke ECT 270. Outline Manipulating style Special effect examples.

Slides:



Advertisements
Similar presentations
© 2010 Delmar, Cengage Learning Chapter 9 Positioning Objects with AP Div Tags.
Advertisements

© Park University, 2006 Creating an Interactive Web Page with DHTML and JavaScript Park University.
CIS67 Foundations for Creating Web Pages Professor Al Fichera Rev. September 22, 2010—All HTML code brought to XHTML standards. Reference for CIS127 and.
© 2011 Delmar, Cengage Learning Chapter 10 Positioning Objects with AP Divs.
JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
CSS Menus and Rollovers. Agenda foil Separating style from content 3 pages in one file Rollovers in CSS Horizontal drop-downs Vertical drop-downs.
1 Lesson 10 Using JavaScript with Styles HTML and JavaScript BASICS, 4 th Edition Barksdale / Turner.
XP 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks Tutorial 7.
Macromedia Dreamweaver 4 Advanced Level Course. Add Rollovers Rollovers or mouseovers are possibly the most popular effects used in designing Web pages.
Chapter 9 Introduction to the Document Object Model (DOM) JavaScript, Third Edition.
Logistics End of class today: if you didn’t finish lab on Wed, get it checked off today Wednesday: Test!
Using Cascading Style Sheets (CSS) Dept. of Computer Science and Computer Information CSCI N-100.
CSS (Cascading Style Sheets): How the web is styled Create Rules that specify how the content of an HTML Element should appear. CSS controls how your web.
HTML 1 Introduction to HTML. 2 Objectives Describe the Internet and its associated key terms Describe the World Wide Web and its associated key terms.
DHTML. What is DHTML?  DHTML is the combination of several built-in browser features in fourth generation browsers that enable a web page to be more.
INTRODUCTION TO DHTML. TOPICS TO BE DISCUSSED……….  Introduction Introduction  UsesUses  ComponentsComponents  Difference between HTML and DHTMLDifference.
XP Tutorial 7New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks.
Image Use. Agenda Ordinary display of image: height, width, alt Rollovers Images as links (remove blue surround) Background images: stretch, tile, xonly/yonly.
Tutorial 4: Using CSS for Page Layout. 2 Objectives Session 4.1 Explore CSS layout Compare types of floating layouts Examine code for CSS layouts View.
© Cheltenham Computer Training 2001 Macromedia Dreamweaver 4 - Slide No 1 Macromedia Dreamweaver 4 Advanced Level Course.
Tutorial 4 Creating Special Effects with CSS
SEG3210 DHTML Tutorial. DHTML DHTML is a combination of technologies used to create dynamic and interactive Web sites. –HTML - For creating text and image.
JavaScript II ECT 270 Robin Burke. Outline JavaScript review Processing Syntax Events and event handling Form validation.
DHTML Positioning and Layout. What is DHTML? HTML and xHTML CSS JavaScript or VBScript.
JQUERY | INTRODUCTION. jQuery  Open source JavaScript library  Simplifies the interactions between  HTML document, or the Document Object Model (DOM),
SEG3210 DHTML Tutorial. DHTML DHTML is a combination of technologies used to create dynamic and interactive Web sites. –HTML - For creating text and image.
Creating an Animated Web Page
CITS1231 Web Technologies JavaScript and Document Object Model.
XP Tutorial 4 New Perspectives on JavaScript, Comprehensive1 Working with Objects Creating an Animated Web Page.
JavaScript, Fourth Edition
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
XP Tutorial 12 New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Working with Special Effects Creating Rollovers, Menus, Filters, and Transitions.
Interactive Client-Side Technologies MMIS 656 Web Design Technologies Acknowledgements: Estrella, S. (2003). The Web Wizard’s Guide to DHTML and CSS.
JavaScript IV ECT 270 Robin Burke. Outline DOM JS document model review W3C DOM.
Introduction to Programming the WWW I CMSC Summer 2003 Lecture 7.
JavaScript - A Web Script Language Fred Durao
 2004 Prentice Hall, Inc. All rights reserved. Chapter 13 - Dynamic HTML: Object Model and Collections Outline 13.1 Introduction 13.2 Object Referencing.
Cascading Style Sheets Robin Burke ECT 360. Outline Midterm CSS CSS selection Positioning SVG Final project.
Internet & World Wide Web How to Program, 5/e. © by Pearson Education, Inc. All Rights Reserved.2 Revised by Dr. T. Tran for CSI3140.
Scripting and Interactivity 이병희
Web Terminology Intro to Web. North Lake College 2 by Sean Griffin HTML vs. XHTML HTML: Hypertext Markup Language XHTML: eXtensible Hypertext Markup Language.
Web Technologies Lecture 3 Web forms. HTML5 forms A component of a webpage that has form controls – Text fields – Buttons – Checkboxes – Range controls.
CSS Layout Cascading Style Sheets. Lesson Overview  In this lesson, you will learn:  float & clear  display & visibility.
Positioning and Printing Creating Special Effects with CSS.
Widgets in Web Design: Where Spry Can Take You Joyce Porter Weber State University Ogden, UT.
CNIT 132 – Week 4 Cascading Style Sheets. Introducing Cascading Style Sheets Style sheets are files or forms that describe the layout and appearance of.
Tutorial 4 Creating Special Effects with CSS. New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 2 Objectives Work with CSS selectors.
Tutorial 4 Creating Special Effects with CSS. New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 2 Objectives Work with CSS selectors.
HTML Concepts and Techniques Fifth Edition Chapter 1 Introduction to HTML.
Introduction to jQuery. 2 Objectives When you complete this chapter, you will be able to: Select elements using jQuery syntax Use built-in jQuery functions.
Tutorial 4 Creating Page Layouts with CSS
XP Tutorial 5 New Perspectives on JavaScript, Comprehensive1 Working with Special Effects Creating Rollovers, Menus, Filters, and Transitions.
Chapter 6 Murach's JavaScript and jQuery, C6© 2012, Mike Murach & Associates, Inc.Slide 1.
Project 7: Exploring DHTML Essentials for Design JavaScript Level Two Michael Brooks.
Chapter 10 Dynamic HTML (DHTML) JavaScript, Third Edition.
Loops Pretest var i=1, sum=0; while (i
JavaScript IV Robin Burke ECT 270. Outline Final project reminder Style review Manipulating style Special effect examples.
SE-2840 Dr. Mark L. Hornick 1 Dynamic HTML Making web pages interactive with JavaScript.
JavaScript and Ajax (JavaScript Dynamic HTML (DHTML)) Week 7 Web site:
XP Tutorial 7New Perspectives on HTML and XHTML, Comprehensive 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks Tutorial 7.
Introduction to Programming the WWW I CMSC Summer 2004 Lecture 8.
XP Tutorial 10 New Perspectives on JavaScript, Comprehensive 1 Working with Dynamic Content and Styles Creating a Dynamic Table of Contents.
Working with Cascading Style Sheets
DHTML.
DOM Robin Burke ECT 360.
Cascading Style Sheets - Building a stylesheet
AJAX Robin Burke ECT 360.
Working with Dynamic Content and Styles
Cascading Style Sheets - Building a stylesheet
One Set of Styles Connected to As Many Pages as You Want!!!
Presentation transcript:

JavaScript V Robin Burke ECT 270

Outline Manipulating style Special effect examples

Manipulating style We can manipulate style dynamically just like other element properties Each element has an associated style object setting the properties of this object change the element's displayed style editing embedded style

Manipulating element class Instead of changing style directly change an element's class let CSS define the transformation Benefit style information not buried in JavaScript elem.className = 'new class' why not elem.class?!

Example class-based rollover expandable outline

Visibility Style property controls whether an element is shown on the page Why would I want to hide content? so I can show it later, dynamically

Controlling visibility Visibility elem.style.visibility = "hidden"; or "visible", "inherit" element takes up space but can't be seen elem.style.display = "none"; or "" element takes up no space

Example validation

Modifying a style associated with a class Stylesheets themselves are objects Accessed via styleSheets[] array Each style sheet has an array of rules cssRules[] (NS) rules [] (IE) We can inspect and modify the styles change affects every element using the style

Example rollover

Manipulating position and boundary Position is another style property also boundary via clip property Many effects possible animation drop down menus

Implementation Relevant DOM properties elem.style.left elem.style.top Problem these are string values with units "5 px", "10 in" Solution IE-specific elem.style.pixelLeft integer valued use text processing parseInt to get value value + "px" to set

Animation Repeated display with transformation Example animation loop repeat until animation ended draw current frame delay change frame

Animation, cont'd Problem looping wastes computer resources worse, prevents user interaction Solution "animation callback" uses JavaScript event mechanism

Animation callback Caller sends the name of a function a delay Event mechanism waits as specified by the delay calls the function SetTimeout (fn, delay)

Animation examples linear shift path animation snowflakes

Controlling display Clipping Can set the size of the container smaller than its contents elem.style.clip = rect(x1, y1, x2, y2);

Controlling display, cont'd Clipping creates a viewing area can't access the rest of the image or contents To shrink viewing area, but allow access change size of the element set overflow property

What to do with excess Use overflow property

Drop-down effects Clipping can be used for drop-down menus purely in HTML no images

Before clipping After clipping

Note Book's DOM API is not needed with Mozilla Book's code is really ugly mine is better

Next Week No class Monday Wednesday XML Reading: w3schools tutorial (XML Basic only)