Logistics End of class today: if you didn’t finish lab on Wed, get it checked off today Wednesday: Test!

Slides:



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

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.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
JavaScript Part 6. Calling JavaScript functions on an event JavaScript doesn’t have a main function like other programming languages but we can imitate.
Slide 1 CMPS 211 Internet Programming Spring 2008 Dynamic Effects with Styles Chapter 12 2/6/08.
Very quick intro HTML and CSS. Sample html A Web Title.
Part 5 Introduction to CSS. CSS Display - Block and Inline Elements A block element is an element that takes up the full width available, and has a line.
CSS Menus and Rollovers. Agenda foil Separating style from content 3 pages in one file Rollovers in CSS Horizontal drop-downs Vertical drop-downs.
SM5312 week 11: CSS Menus & Navigation Bars1 An Introduction to Cascading Style Sheets CSS Menus and Navigation Bars Nick Foxall.
With CSS, a color is most often specified by: a HEX value - like "#ff0000" an RGB value - like "rgb(255,0,0)" a color name - like "red“ Example h1.
CIS 1310 – HTML & CSS 6 Layout. CIS 1310 – HTML & CSS Learning Outcomes  Describe & Apply the CSS Box Model  Configure Float with CSS  Designate Positioning.
Lesson 12- Unit L Programming Web Pages with JavaScript.
Using CSS for Page Layout. Types of HTML Elements Block-Level Element –Creates blocks of content e.g. div, h1..h6, p, ul, ol, li, table, form –They start.
Web-based Application Development Lecture 9 February 7, 2006 Anita Raja.
 2008 Pearson Education, Inc. All rights reserved Document Object Model (DOM): Objects and Collections.
Purpose Tags are the key to marking up content on your HTML page. It’s the tags that mark up sections of the page and are defined (aesthetically) on the.
Advanced CSS - Page Layout. Advanced CSS  Compound Selectors:  Is a Dreamweaver term, not a CSS term.  Describes more advanced types of selectors such.
HTML DOM.  The HTML DOM defines a standard way for accessing and manipulating HTML documents.  The DOM presents an HTML document as a tree- structure.
Tutorial 4 Creating Special Effects with CSS
 2008 Pearson Education, Inc. All rights reserved Document Object Model (DOM): Objects and Collections.
JQuery 10/21. Today jQuery Some cool tools around the web JavaScript Libraries Drawing libraries HTML Frameworks Conventions.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6 Dynamic Documents With JavaScript.
JavaScript & DOM Client-side scripting. JavaScript JavaScript is a tool to automate client side (which is implemented using HTML so far) JavaSript syntax.
Lecture 11 – DOM Scripting SFDV3011 – Advanced Web Development Reference: 1.
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.
Chapter 12 FRAMES. HOW FRAMES WORK When you view a framed page in a browser, you are actually looking at several HTML documents at once. The key to making.
JavaScript – The DOM JavaScript is object based The browser is object based – We can access the browser's objects in the same way we did JavaScript's Two.
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
Introduction to Programming the WWW I CMSC Summer 2003 Lecture 7.
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
Week 8 – Part 2 Page Layout Basics Key Concepts 1.
Internet & World Wide Web How to Program, 5/e. © by Pearson Education, Inc. All Rights Reserved.2 Revised by Dr. T. Tran for CSI3140.
Windows and frames and the anchor tag. Frames Independent, scrollable portions of a Web browser window, with each frame capable of containing its own.
 2008 Pearson Education, Inc. All rights reserved Document Object Model (DOM): Objects and Collections.
CSS Layout Cascading Style Sheets. Lesson Overview  In this lesson, you will learn:  float & clear  display & visibility.
JavaScript V Robin Burke ECT 270. Outline Manipulating style Special effect examples.
Dr. Ahmet Cengizhan Dirican BIL 374 Internet Technologies 6. Dynamic Documents With JavaScript.
This is our seminar JavaScript And DOM This is our seminar JavaScript And DOM.
Chapter 6 Murach's JavaScript and jQuery, C6© 2012, Mike Murach & Associates, Inc.Slide 1.
Today’s objectives  Announcements  Positioning  Measurement units.
Chapter 10 Dynamic HTML (DHTML) JavaScript, Third Edition.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 2 Key Concepts 1 Copyright © Terry Felke-Morris.
COM621: Advanced Interactive Web Development Lecture 6 – JavaScript (cont.)
Introduction to.
Cascading Style Sheets Layout
Programming Web Pages with JavaScript
Unit M Programming Web Pages with
CSS Layouts: Grouping Elements
Unit M Programming Web Pages with
CGS 3066: Web Programming and Design Spring 2017
Putting Things Where We Want Them
Chapter 7 Page Layout Basics Key Concepts
Document Object Model (DOM): Objects and Collections
PAGE LAYOUT - 2.  The div tag equipped with CSS rules produces good looking pages.  With CSS, the div tag can easily be positioned anywhere on the page.
Basics of Web Design Chapter 7 Page Layout Basics Key Concepts
DHTML Javascript Internet Technology.
Positioning.
Basic HTML and Embed Codes
DHTML Javascript Internet Technology.
Working with Dynamic Content and Styles
Web Development & Design Foundations with H T M L 5
Positioning.
Week 5: Recap and Portfolio Site
Web Programming and Design
Presentation transcript:

Logistics End of class today: if you didn’t finish lab on Wed, get it checked off today Wednesday: Test!

Lab Reserved variable names (string, document) –Must be called within –Includes the contents of that script into your page

Lab Valid HTML= Doctype dec. XML root element contains metadata required element in head contains document contents

Lab Web programming is hard –Don’t just copy crap you don’t understand –Write down a plan as comments in your working document

Best looping code ever: var index = (myarray.length -1) % counter; alert(myarray[index]);

JS DOM Document Object Model

Nodes Nodes are anything in an XHTML document Elements / Molecules as Nodes / Atoms

Nodes Text node Element node Document node Attribute node

Accessing Nodes node.getElementById(‘id’) node.getElementsByTagName(‘tag’) Example: mydiv = Document.getElementById(‘mydiv’);

Accessing Nodes

Node Properties n.nodeNameName of a node n.nodevalueValue of a node n.nodeTypeDocument(9), element(1), attribute(2) or text(3) n.parentNodeNode’s Parent n.childNodesArray of children n.attributesArray of attributes

Node Properties (cont) n.previousSiblingPointer to previous element n.nextSiblingPointer to next element n.firstChildFirst child n.lastChildLast child

Getting Node Info

Manipulating Nodes createElement(element_name) insertBefore(ur_node, node) node.appendChild(node) node.removeChild(node)

createElement() var new_para = createElement(‘p’); This creates an instance of an element – it does not add it to the page!!!!!!!!!

createElement() var new_para = createElement(‘p’); var p= Document.getElementById(‘some_p’); document.insertBefore(new_para, p); new_para is now the first child in mydiv (and visible on the page)

createElement() var new_para = createElement(‘p’); var mydiv= Document.getElementById(‘my_div’); mydiv.appendChild(new_para); new_para is now the last child in mydiv (and visible on the page)

Manipulating Nodes

Shortcuts element.innerHTML –Gets or sets all the html content of an element –Supported all major browsers –Not supported by w3c

More Shortcuts: Get or Set element.src –the source of an img, script or iframe element.style.(…css property) element.className –(not element.class to avoid name space collision) element.href (value of a link) element.value (value of an input element)

DOM Properties Almost any valid HTML attribute can be accessed as a DOM property.

Wait, these shortcuts suck Class v. className …. Solution: node.setAttribute(‘attname’, ‘value’);

setAttribute Example: var mydiv = Document.getElementById(‘mydiv’); mydiv.setAttribute(‘class’, ‘highlight’);

Solutions Lightbox: –Function that Takes a string of HTML to display creates a div just under the element –Make that div have a ‘lightbox’ class –In your CSS, let lightbox have 100% height & width A semi-transparent background

Lightbox cont… Create a child div that is smaller than its parent and holds your image, text…what ever Add a ‘close’ link to the string being passed into your lightbox function Set that links onclick attribute to fire a Closelb() function that destroys the lightbox div –Add an onclick event on your page that fires off your lightbox function

Tool tip Very similar to the lightbox Function must take a string, and a x/y pos of the clickable element. Instantiate a new element near the clickable element. Or Unhide a child element within the clickable element

Flyout Menus Using CSS, hide s inside s ul li ul {display: none;} CSS: move child lists along side their parent’s (instead of below) ul { position: relative;} li ul {position: absolute; top: -20px; left: 200px;} Unhide the child list when the parent is mouse over’d using JS. myul.style.display = ‘block’;

Sliding things Position absolute Incrementally (settimeout) increase/decrease top and left values //loop myelement.style.top = myelement.style.top + 1; //end loop Scroll effect: –Specify parent div size –Set parent overflow to ‘hidden’ (css property)

In Class Project Produce a list of links to images. Clicking a link causes the spec’d image to load (without reloading the page). How are you going to store the list of image URLs? What is the edge case?