1 Lesson 10 Using JavaScript with Styles HTML and JavaScript BASICS, 4 th Edition Barksdale / Turner.

Slides:



Advertisements
Similar presentations
HTML I. HTML Hypertext mark-up language. Uses tags to identify elements of a page so that a browser such as Internet explorer can render the page on a.
Advertisements

Cascading Style Sheets
HTML Overview - Cascading Style Sheets (CSS). Before We Begin Make a copy of one of your HTML file you have previously created Make a copy of one of your.
CHAPTER 7 STYLING CONTENT WITH CASCADING STYLE SHEETS.
1 Lesson 5 Introduction to Cascading Style Sheets HTML and JavaScript BASICS, 4 th Edition Barksdale / Turner.
Chapter 8 Creating Style Sheets.
1 Lesson 9 Using JavaScript with Frames HTML and JavaScript BASICS, 4 th Edition Barksdale / Turner.
HTML5 and CSS3 Illustrated Unit B: Getting Started with HTML
16 HTML Tables and Frames Section 16.1 Create a basic table using HTML Define borders Merge cells Align content in tables Section 16.2 Create a frames-based.
COMPSCI 345 / SOFTENG 350 TUTORIAL WEEK 8 | SAM KAVANAGH.
Chapter 7 Using Advanced Cascading Style Sheets HTML5 & CSS 7 th Edition.
XHTML1 Tables and Lists. XHTML2 Objectives In this chapter, you will: Create basic tables Structure tables Format tables Create lists.
Chapter 16 Dynamic HTML and Animation The Web Warrior Guide to Web Design Technologies.
JavaScript 101 Lesson 5: Introduction to Events. Lesson Topics Event driven programming Events and event handlers The onClick event handler for hyperlinks.
Copyright © 2004 ProsoftTraining, All Rights Reserved. Lesson 9: Frames © 2007 Prosoft Learning Corporation All rights reserved ITD 110 Web Page Design.
Lesson 4 HTML Structural Design Techniques
Copyright © 2004 ProsoftTraining, All Rights Reserved. Lesson 9: HTML Frames.
1 Lesson 1 Quick HTML Know-How HTML and JavaScript BASICS, 4 th Edition Barksdale / Turner.
Lesson 8 Creating Forms with JavaScript
© 2011 Delmar, Cengage Learning Chapter 2 Developing a Web Page.
© 2010 Delmar, Cengage Learning Chapter 7 Using Styles and Style Sheets for Design.
Working with Cascading Style Sheets. Introducing Cascading Style Sheets Style sheets are files or forms that describe the layout and appearance of a document.
Chapter 11 Cascading Style Sheets: Part I The Web Warrior Guide to Web Design Technologies.
Chapter 3 Working with Text and Cascading Style Sheets.
Copyright © Texas Education Agency, All rights reserved. 1 Web Technologies Website Development with Dreamweaver.
Using Styles and Style Sheets for Design
Basic HTML Hyper text markup Language. Re-cap  … - The tag tells the browser that this is an HTML document The html element is the outermost element.
NetTech Solutions Working with Web Elements Lesson 6.
Chapter 2 Developing a Web Page. A web page is composed of two distinct sections: –The head content –The body Creating Head Content and Setting Page Properties.
Adding User Interactivity – Lesson 51 Adding User Interactivity Lesson 5.
Intro to Dreamweaver Web Design Section 7-1 Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development I” Course.
1 Lesson 7 Using Images with JavaScript HTML and JavaScript BASICS, 4 th Edition Barksdale / Turner.
Integrating JavaScript and HTML5 HTML5 & CSS 7 th Edition.
Introduction to Applets CS 3505 Client Side Scripting with applets.
1 Lesson 3 Power Techniques HTML and JavaScript BASICS, 4 th Edition Barksdale / Turner.
 cascade Style Sheets (CSS) is a mark-up language that was first proposed in 1994 by Håkon Wium Lie. CSS works in conjunction with HTML to greatly increase.
JavaScript, Fourth Edition
Copyright 2007, Information Builders. Slide 1 Understanding Basic HTML Amanda Regan Technical Director June, 2008.
© 2011 Delmar, Cengage Learning Chapter 8 Using Styles and Design Style Sheets for Design.
Cascading Style Sheets Part 1. CSS vs HTML HTML: Originally intended to markup structure of a document (,...,,,,,...) CSS Developing technology, CSS1,
CS134 Web Design & Development Cascading Style Sheets (CSS) Mehmud Abliz.
Introduction to Cascading Style-sheets (CSS) Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan 1.
META tag META tag is the element in the HTML that interacts with the search engines. It’s contain 2 attributes that should always be used: NAME: is an.
1 Web Application Programming Presented by: Mehwish Shafiq.
© 2011 Delmar, Cengage Learning Chapter 3 Working with Text and Cascading Style Sheets.
Internet & World Wide Web How to Program, 5/e. © by Pearson Education, Inc. All Rights Reserved.2 Revised by Dr. T. Tran for CSI3140.
Cascading Style Sheets CSS. Source W3Schools
DYNAMIC HTML What is Dynamic HTML: HTML code that allow you to change/ specify the style of your web pages. Example: specify style sheet, object model.
HTML JAVASCRIPT. CONTENTS Javascript Example NOSCRIPT Tag Advantages Summary Exercise.
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.
Are You Smarter Than a 5 th Grader? 1,000,000 5th Grade HTML 5th Grade Syntax 4th Grade HTML 4th Grade Syntax 3rd Grade HTML 3rd Grade Syntax 2nd Grade.
HTML A brief introduction HTML1. HTML, what is? HTML is a markup language for describing web documents (web pages). HTML stands for Hyper Text Markup.
Headings are defined with the to tags. defines the largest heading. defines the smallest heading. Note: Browsers automatically add an empty line before.
INTRODUCTION JavaScript can make websites more interactive, interesting, and user-friendly.
Document Object Model Nasrullah. DOM When a page is loaded,browser creates a Document Object Model of the Page.
Cascading Style Sheets (CSS) EXPLORING COMPUTER SCIENCE – LESSON 3-5.
1 Lesson 6 Introducing JavaScript HTML and JavaScript BASICS, 4 th Edition.
Project 7: Exploring DHTML Essentials for Design JavaScript Level Two Michael Brooks.
Chapter 10 Dynamic HTML (DHTML) JavaScript, Third Edition.
Adding Interactivity Comp 140 Fall Web 2.0 Major change in internet usage –From mostly static pages Text Graphics Simple links –To new paradigm.
HTML5 and CSS3 Illustrated Unit C: Getting Started with CSS.
HTML5 and CSS3 Illustrated Unit B: Getting Started with HTML.
Source of website: “Text/css rel=“styles heet” This is an external style sheet link. This means that the.
WEB FOUNDATIONS CSS Overview. Outline  What is CSS  What does it do  Where are styles stored  Why use them  What is the cascade effect  CSS Syntax.
Web Basics: HTML/CSS/JavaScript What are they?
Getting Started with CSS
Tutorial 9 Working with XHTML
HTML A brief introduction HTML.
HTML and CSS Basics.
HTML5 and CSS3 Illustrated Unit B: Getting Started with HTML
Presentation transcript:

1 Lesson 10 Using JavaScript with Styles HTML and JavaScript BASICS, 4 th Edition Barksdale / Turner

Lesson 10 Barksdale / TurnerHTML and JavaScript BASICS 4E 22 Objectives Define a simple frame-based style viewer. Make your style viewer functional. Define a simple frame-based document viewer. Make your document viewer functional. Create a dynamic style class viewer.

Lesson 10 Barksdale / TurnerHTML and JavaScript BASICS 4E 33 Vocabulary element getElementById() getElementsByTag Name() id location render style style viewer

Lesson 10 Barksdale / TurnerHTML and JavaScript BASICS 4E 44 Defining a Style Viewer The HTML style attribute can be applied to virtually any HTML tag to describe how you want the Web browser to display that portion of the Web page. Although styles are by no means limited to text, applying a style to an HTML tag is one of the most common ways in which styles are applied.

Lesson 10 Barksdale / TurnerHTML and JavaScript BASICS 4E 55 Defining a Style Viewer (continued) The term render simply means to display with the proper attributes applied. An element is just an HTML tag, and once you have identified the element you need to modify, you make it accessible to JavaScript by assigning it an identifying name with the id attribute.

Lesson 10 Barksdale / TurnerHTML and JavaScript BASICS 4E 66 Defining a Style Viewer (continued) A style viewer is a simple tool that allows users to specify a style, apply the style, and then view the results. Frame-based style viewer

Lesson 10 Barksdale / TurnerHTML and JavaScript BASICS 4E 77 Making Your Style Viewer Functional If a JavaScript event occurs in one frame and the effect of the event is within the same frame, then the JavaScript code should reside in the same frame file. If a JavaScript event occurs in one frame and affects an object or element in a different frame, the code can often be kept to its simplest form if it is defined in the top-level frameset file.

Lesson 10 Barksdale / TurnerHTML and JavaScript BASICS 4E 88 Making Your Style Viewer Functional (continued) In order for JavaScript code to access an HTML tag with an id attribute, a corresponding JavaScript method called getElementById() must be invoked. This method accepts a single parameter, the id of the HTML element you want to access.

Lesson 10 Barksdale / TurnerHTML and JavaScript BASICS 4E 99 Defining a Frame-Based Document Viewer A simple document viewer that moves hyperlinks and headers out of the original HTML document and places them in their own frame adds functionality to a Web page.

Lesson 10 Barksdale / TurnerHTML and JavaScript BASICS 4E 10 Defining a Frame-Based Document Viewer (continued) Frame-based document viewer As shown in Step- by-Step 10.3, the document viewer approach makes the H2 headers more accessible and highlights the active header.

Lesson 10 Barksdale / TurnerHTML and JavaScript BASICS 4E 11 Making Your Document Viewer Functional The process of making a document viewer Web page functional is similar to making your style viewer functional. Functional document viewer— Fancy Fonts selected

Lesson 10 Barksdale / TurnerHTML and JavaScript BASICS 4E 12 Making Your Document Viewer Functional (continued) The JavaScript code in this section uses the getElementById() method to identify and access the modified HTML elements. A new function uses the JavaScript getElementsByTagName() method to reference an array of HTML elements to which a cascading style has been applied. The location property simply contains the URL of the current HTML document.

Lesson 10 Barksdale / TurnerHTML and JavaScript BASICS 4E 13 Creating Dynamic Content with JavaScript Style Classes You can define many different style attributes in a style class within a Cascading Style Sheet. The style class is then applied, by means of the class attribute, to an HTML element, and all of the attributes in the class take effect simultaneously.

Lesson 10 Barksdale / TurnerHTML and JavaScript BASICS 4E 14 Creating Dynamic Content with JavaScript Style Classes (continued ) JavaScript can accomplish the same effect by changing the style class assigned to a Web page element. Functional style class viewer— final state

Lesson 10 Barksdale / TurnerHTML and JavaScript BASICS 4E 15 Summary In this lesson, you learned: How to define a simple frame-based style viewer. How to make your style viewer functional. How to define a simple frame-based document viewer.

Lesson 10 Barksdale / TurnerHTML and JavaScript BASICS 4E Summary (continued) How to make your document viewer functional. How to create a dynamic style class viewer. 16