Creating Active Web Pages Chapter 8 Learn how to… List the primary scripting languages and describe JavaScript. Understand the purpose of the Document.

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

JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
Cascading Style Sheets (CSS). Cascading Style Sheets With the explosive growth of the World Wide Web, designers and programmers quickly explored and reached.
CSS Cascading Style Sheets. Objectives Using Inline Styles Working with Selectors Using Embedded Styles Using an External Style Sheet Applying a Style.
XHTML Basics.
Cascading Style Sheets. CSS stands for Cascading Style Sheets and is a simple styling language which allows attaching style to HTML elements. CSS is a.
1 eVenzia Technologies Learning HTML, XHTML & CSS Chapter 1.
The Web Warrior Guide to Web Design Technologies
Project 1 Introduction to HTML.
3 November 2008CIS 340 # 1 Topics To define XML as a technology To place XML in the context of system architectures.
Chapter Concepts Review Markup Languages
XP Tutorial 1 New Perspectives on JavaScript, Comprehensive1 Introducing JavaScript Hiding Addresses from Spammers.
1st Project Introduction to HTML.
4.01B Authoring Languages and Web Authoring Software 4.01 Examine webpage development and design.
Tutorial 3: Adding and Formatting Text. 2 Objectives Session 3.1 Type text into a page Copy text from a document and paste it into a page Check for spelling.
Chapter 2 Introduction to HTML5 Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
Chapter 14 Introduction to HTML
2440: 141 Web Site Administration Web Server-Side Programming Professor: Enoch E. Damson.
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.
Chapter ONE Introduction to HTML.
Review HTML  What is HTML?  HTML is a language for describing web pages.  HTML stands for Hyper Text Markup Language  HTML is not a programming language,
Chapter 12 Creating and Using XML Documents HTML5 AND CSS Seventh Edition.
 Using Microsoft Expression Web you can: › Create Web pages and Web sites › Set what you site will look like as you design it › Add text, images, multimedia.
Creating a Simple Page: HTML Overview
Multimedia and Web Technology Prepared by: Asst. Prof. Maryam Eskandari.
Chapter 2: The Client Side: HTML CIS 275—Web Application Development for Business I.
Chapter 4 Dreamweaver: Part II The Web Warrior Guide to Web Design Technologies.
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.
Chapter 4 Cascading Style Sheets Basics Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D 1.
Creating a Basic Web Page
JavaScript, Fifth Edition Chapter 1 Introduction to JavaScript.
ULI101 – XHTML Basics (Part II) What is Markup Language? XHTML vs. HTML General XHTML Rules Block Level XHTML Tags XHTML Validation.
Advanced Web Design Scripting Tutorial Chapters. Scripting Intro The scripting part of the forthcoming Advanced Web Design textbook introduces you to.
SEG3210 DHTML Tutorial. DHTML DHTML is a combination of technologies used to create dynamic and interactive Web sites. –HTML - For creating text and image.
HTML (HyperText Markup Language)
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.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
Learning Web Design: Chapter 4. HTML  Hypertext Markup Language (HTML)  Uses tags to tell the browser the start and end of a certain kind of formatting.
CP2022 Multimedia Internet Communication1 HTML and Hypertext The workings of the web Lecture 7.
SEG3210 DHTML Tutorial. DHTML DHTML is a combination of technologies used to create dynamic and interactive Web sites. –HTML - For creating text and image.
HTML, XHTML, and CSS Sixth Edition Chapter 1 Introduction to HTML, XHTML, and CSS.
 2008 Pearson Education, Inc. All rights reserved Introduction to XHTML.
INTRODUCTION TO CSS. OBJECTIVES: D EFINE WHAT CSS IS. K NOW THE HISTORY OF CSS. K NOW THE REASON WHY CSS IS USED. CSS SYNTAX. CSS ID AND CLASS.
CSS Basic (cascading style sheets)
INTRODUCTION. What is HTML? HTML is a language for describing web pages. HTML stands for Hyper Text Markup Language HTML is not a programming language,
XP Tutorial 10New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with JavaScript Creating a Programmable Web Page for North Pole.
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
Active Server Pages  In this chapter, you will learn:  How browsers and servers interacted on the Internet when the Internet first became popular 
Css. Definition Cascading style sheet (CSS)  It is a simple mechanism for adding style (e.g. fonts, colors, spacing) to Web documents.
HTML: Hyptertext Markup Language Doman’s Sections.
Dr. Qusai Abuein1 Internet & WWW How to program Chap.(6) JavaScript:Introduction to Scripting.
4.01B Authoring Languages and Web Authoring Software 4.01 Examine webpage development and design.
CSS Cascading Style Sheets A very brief introduction CSS, Cascading Style Sheets1.
HTML Concepts and Techniques Fifth Edition Chapter 1 Introduction to HTML.
Chapter 1 Introduction to HTML, XHTML, and CSS HTML5 & CSS 7 th Edition.
Basic HTML Document Structure. Slide 2 Goals (XHTML HTML5) XHTML Separate document structure and content from document formatting HTML 5 Create a formal.
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
Cascading Style Sheet CSS Closing Switch Closing Tag Code View
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
Microsoft Expression Web - Illustrated Unit A: Getting Started With Microsoft Expression Web.
DHTML.
Project 1 Introduction to HTML.
Chapter 1 Introduction to HTML.
W3C Web standards and Recommendations
Project 1 Introduction to HTML.
What are Cascading Stylesheets (CSS)?
Teaching slides Chapter 6.
Understand basic HTML and CSS terminology, concepts, and basic operations. Objective 3.01.
Presentation transcript:

Creating Active Web Pages Chapter 8

Learn how to… List the primary scripting languages and describe JavaScript. Understand the purpose of the Document Object Model (DOM). Use cookies. Use cascading style sheets. Use Dynamic HTML to create animated Web pages. Understand XML, XSL, XSLT, XHTML, and SMIL.

Introduction to Scripting

Scripting Scripting is the act of writing little computer programs that can enhance the appearance and functionality of a Web page.

Scripting Languages JavaScript runs client-side in the browser without requiring any server-side processing. Server-side scripting languages include: –VBScript and JScript –Microsoft’s Active Server Page (ASP) languages –C# (pronounced C-sharp) –Java –J# (Microsoft’s version of Java – pronounced J-sharp)

Where Do Scripts Go? You can put JavaScript in the head or in the body section of a Web page. Scripts can also reside in a separate file called an include file, which gets included in the page at runtime. A function is a named procedure you can call upon by name any time you need to execute the code in the function.

Where Do Scripts Run? Scripts run either on the client (or browser) or on the server that hosts the Web site. –JavaScript runs on the client. Use whenever the process you are handling can be accomplished by the browser without requiring any programming on the server side. –ASP scripts run on the server.

Hello World!

Code Analysis The start and stop tags mark the beginning and ending of a script on a Web page. The language attribute defines the language as JavaScript. The document object is one of the JavaScript objects. The write() method causes a string of characters to be written onscreen.

Variables and Strings A variable is a place in the computer’s RAM that remembers, or stores, the value of something changeable. A string is a sequence of one or more alphanumeric characters. A string variable is a place in the computer memory that remembers, or stores, the alphanumeric characters in a string.

Variables A numeric variable is a place in the computer memory that remembers, or stores, a number point. A floating point number has a decimal point with one or more numbers after the decimal point.

Variable Names A variable name is the identifier used to refer to, or call upon, a place in the computer memory that stores the value of a variable. Follow a naming convention whereby integers begin with the letter i, strings begin with the letter s, and floating point numbers begin with the letter f.

Operators An operator is a symbol that causes a script to perform some kind of action on a variable or value. The assignment operator assigns values to variables.

Example Comment statements begin with the special symbol //.

Code Analysis

Concatenating Strings To concatenate means to join strings together via the concatenation operator. –In JavaScript, the concatenation operator is the + sign.

Example

Numeric Variables

Displaying Strings The and tags will make the person’s age and weight appear bold. JavaScript uses the special symbol " \" to denote a quote sign inside a string. The code to display the string Santa sang "Jingle Bells" as he drove the sleigh is given below.

Objects and Methods An object is a self-contained entity consisting of properties and methods enabling you to do something programmatically. A method is a little computer program built into an object to enable the object to do something.

Properties A property is an attribute of an object that has a value. –Properties can be used to check whether a user typed in his address properly.

Events An event is an action that provides an opportunity to trigger a script that can use objects to inspect properties and execute methods that make things happen onscreen or keep records behind the scenes.

Most Common Events Mouseover Mouse click Double-click Page load

JavaScript Clock Project

Customizing Date and Time

Example

Document Object Model (DOM)

DOM The document object model (DOM) is the official W3C structural definition of the objects, methods, and properties that comprise documents on the World Wide Web. –Visit for more information.

DOM Objects

Intrinsic Events

Dot Notation

Title Bar Clock Example This script will display the current time in the title bar.

Title Bar Clock Example

Arrays An array is a named table of memory locations in which values can be stored. –Defines an array with 7 slots (0 through 6). –Assigns values to the array slots.

DOM Objects by Arrays When a Web page loads, the browser creates arrays for the images, forms, links, anchors, and all the other elements onscreen. As the browser encounters objects on the page, it places them into these arrays. The arrays are indexed sequentially, beginning with zero. –For example, the first image on the page goes into the images array slot 0 referred to as document.images[0] –In this example, the third button on the first form of a Web page would be referred to as document.forms[0].elements[2]

DOM Objects by Name Use the name and id attributes to give the element a unique identifier. –Older versions of HTML use name. –New versions of HTML use id.

Example The following script provides three buttons that allow users to make an image smaller or larger.

Alert Boxes To aid in troubleshooting, insert an alert box at the point in the script at which you want to inspect the value of the variable. An alert box is a window that a script creates by executing the alert() method of the JavaScript window object. –Insert the string of characters and variables you want displayed between the ( ) in the alert() method.

Inspecting a Variable The code to inspect the value of a variable using an alert box to troubleshoot is given below:

JavaScript Code Sources

Rollover Effects The following script causes the photo to change when you rollover it with the mouse:

Rollover Effects The following script causes the picture to change from a dimly colored photo to full color in Internet Explorer:

Maintaining State in Cookies

Cookies A cookie is a place in the computer’s memory where browsers can store information about the user. –persistent cookies are stored in small text files on the user’s hard disk. –per-session cookies are stored in RAM. Cookies can be used to keep track of what you do on Web sites – that is, to maintain state.

Reading and Writing Cookies

Code Analysis To make the cookie persistent for 1 minute:

Code Analysis The script stores the click counter value in a cookie called ClickCounter. The value is read into a variable called iClickCounter.

Code Analysis

Cascading Style Sheets

A cascading style sheet (CSS) is a set of rules that define styles to be applied to entire Web pages or individual Web page elements. –Each rule consists of a selector followed by a set of curly braces containing the style properties and their values.

Cascading Style Sheets

Types of CSS An external CSS keeps all the style definitions in a separate CSS file that you include in a Web page at runtime by using the tag to apply the style sheet to the page. An embedded CSS is a style sheet that gets copied physically into the head of the Web page and applies to the Web page as a whole. An inline CSS is a style sheet that applies to only one page element so it gets copied “inline” on the page with that element.

An Inline CSS

An Embedded CSS The embedded CSS goes into the head section of the page, and the style rules defined there apply to the whole page. Below, styles are assigned to h1 headers and paragraphs:

Inline and Embedded CSS

An External CSS Create a style sheet and save it with the.css extension: In the section, reference your CSS:

and Tags Use the and tags to stylize part, instead of all, of a Web page element. In this example, “yellow words” has its own style: – Notice how yellow words appear onscreen. The and tags create a new division or line break, but otherwise function just like the tag.

Creating a Style Class A class is a named definition of one or more styles. –Create the class by prefixing its name with a dot in the CSS file.

Creating a Style ID An ID is a unique style identifier intended to apply to one, and only one, Web page element onscreen.

Absolute Positioning Absolute positioning enables you to position page elements precisely onscreen based on x,y coordinates. –The upper-left corner of the browser window is position 0,0. –Absolute positioning allows you to position overlapping objects. The z-index can be used to tell the browser the order in which to display objects that overlap.

Z-index Example

Dynamic HTML

Dynamic HTML is a term invented by Microsoft to refer to the animated Web pages you can create using the DOM to combine HTML with style sheets and scripts that bring Web pages to life.

Animation Effects You can use absolute positioning to place an object anywhere on the screen. JavaScript has a timer event that allows you to vary the x,y coordinates dynamically.

Animation Effects Code

Code Analysis The start tag is programmed to fire the BeginAnimation() function when the page loads:

Code Analysis

Gradient Effects A gradient is a graphical effect created by colors fading gradually across or down the screen.

Dynamic Gradient Effects The code to create a gradient background for a Web page is given below: –The color is formatted #AARRGGBB, where AA is the opacity ranging from 00 (transparent) to FF (full color), RR is red, GG is green, and BB is blue.

Page Transitions A page transition is the style or manner in which the screen changes when the browser brings up a new document and displays it onscreen.

Page Transitions To set the transition effect that users will see when the page comes onscreen, insert the following in the section: To set the transition effect that users will see when the page leaves the screen:

Page Transitions

Microsoft’s Code Generator DXTidemo/DXTidemo.htm

XML and XHTML

What Is XML? XML (eXtensible Markup Language) is a simple, self-describing markup language that enables computers to read and understand the structure of different kinds of documents and to exchange data across different operating systems, software applications, and hardware configurations without requiring any human intervention. –Tags define the structure of the data. –Visit for more information.

XML Schema An XML schema is the structural definition of the types of elements that can appear in a document, the attributes each element may have, and the relationships among the elements. –Schema files end in XSD (XML Schema Definition).

Sample XML Schema

Encoding XML Data

DOCTYPE Declaration The DOCTYPE declaration identifies the schema that defines the tag structure. –If all tags precisely follow the schema, the document validates and is well formed. –If it does not validate, it is malformed.

XML Editor XML files are plain text and can be created and edited with Notepad. However, it is easier to use an XML editor. –Microsoft’s Visual Studio.NET is the premier suite of tools for creating Web applications.

XSL eXtensible Stylesheet Language (XSL) is an XML dialect that Web designers use to specify the styling, layout, and pagination of the structured content in an XML document for some targeted presentation medium, such as a Web browser, a printer, an eBook, a screen reader, or a hand-held device. –Visit for more information.

XSLT XSL Transformation (XSLT) language is an XML dialect that Web designers use to transform documents from one format into another.

XSLT Example

Loose and Strict HTML Loose structural rules means that the Web page is using structural elements in use today but that may fade in the future. –To declare a page using the loose definition: –To declare a page using the strict definition:

Loose and Strict XHTML XHTML is a reformulation of HTML in XML. Loose XHTML relates to the differences between XML and SGML. –To define loose XHTML: –To define strict XHTML: For more info, go to

XML Module and SMIL An XML module is a collection of semantically- related XML elements and attributes oriented toward accomplishing a certain task or function. Synchronized Multimedia Implementation Language (SMIL) is an XML-based language that was created by the W3C for enabling developers to include multimedia events in Web documents.

XHTML+SMIL XHTML+SMIL permits the Web designer to use SMIL animations, timings, and transitions within a conventional HTML or CSS page layout. –HTML+TIME is Microsoft’s implementation that works with IE versions 5.5 and later.