25
XHTML Review Part 2 Instructor: Nancy Lee

Xhtml Part2

Embed Size (px)

Citation preview

Page 1: Xhtml Part2

XHTML ReviewPart 2

Instructor: Nancy Lee

Page 2: Xhtml Part2

Course Objectives

To be able to create tables with rows and columns of data.

To be able to control table formatting

To be able to create and use forms

To be able to create and use image maps to aid in Web-page navigation

To be able to make Web pages accessible to search engines using <meta> tags

To be able to use the frameset element to display multiple Web pages in a single browser window.

Page 3: Xhtml Part2

Introduction

Using tables to present information on web page

Forms to gather data

Page 4: Xhtml Part2

Basic XHTML Tables

Used to organize data into rows and columns table1.html element <table> </table>

defines a table attributes

border• no border= “0”

width summary

• used by speech synthesizers

Page 5: Xhtml Part2

Basic XHTML Tables

element <caption> </caption> accessibility element in XHTML describes table contents

Page 6: Xhtml Part2

Basic XHTML Tables

Table has three parts Head

Body

foot

Page 7: Xhtml Part2

Basic XHTML Tables

Table has three parts head

column names <thead> </thead> element <tr></tr> element

• Defines rows <th></th>

• Defines header column

Page 8: Xhtml Part2

Basic XHTML Tables

Table has three parts head body

<tbody> </tbody> element <tr></tr>

• Rows <td> </td>

• columns

Page 9: Xhtml Part2

Basic XHTML Tables

Table has three parts head body foot

Contains totals and footnotes <tfoot></tfoot>

• Defines foot of table <tr></tr> <th></th> element

Page 10: Xhtml Part2

Intermediate XHTML Tables and Formatting

Elements required to build more complex tables table2.html <colgroup> </colgroup> element

Groups and formats columns <col> </col> element

Attributes• Align• Span

Value how many columns the <col> formats• colspan• rowspan• valign

“top” “middle” “bottom”

Page 11: Xhtml Part2

Basic XHTML Forms

Used to collect data from user.

Used to collect data from user.

XHTML uses HTTP (Hypertext Transfer Protocol).

Page 12: Xhtml Part2

Basic XHTML Forms

Used to collect data from user XHTML uses HTTP (Hypertext Transfer Protocol) Example program sends the form data to the Web

Server which passes the form to a CGI (Common Gateway Interface) Written in Perl, C or some other language Submit will cause error as server is not

configuredWe will do that later in ASP.NET

Page 13: Xhtml Part2

Basic XHTML Forms

Used to collect data from user XHTML uses HTTP (Hypertext Transfer Protocol) Example program sends the form data to the Web

Server which passes the form to a CGI (Common Gateway Interface) Written in Perl, C or some other language Submit will cause error as server is not configured

We will do that later in ASP.NET Forms can contain visual and non visual components

Hidden inputs Store data in documents specified

Page 14: Xhtml Part2

Basic XHTML Forms

<form> </form> element Attributes

method• Specifies how form’s data is sent to the Web server• Value “post” appends form data to the browser request

Contains the protocol Requested sources URL Scripts in the web server will process the data

• Value “get” appends for data directly to the end of the URL• We will discuss these in detail later

action • specifies the URL of a script on the Web server• Most ISPs have a formmail script

Page 15: Xhtml Part2

Basic XHTML Forms

<input /> element Attributes

type • value

“hidden” used by web server script “text” “submit” button sends form to server “reset” resets all the components in form

name • identifies element to script• value is used by server to process input

size • sets the length of the component

maxlength• sets the maximum number of characters

Page 16: Xhtml Part2

Basic XHTML Forms

<label></label> element is used to label the form components.

Page 17: Xhtml Part2

More Complex XHTML Forms

Add some components to the basic form to enhance it. form2.html adds some new components

<textarea> </textarea> Attributes

• rows• cols

Page 18: Xhtml Part2

More Complex XHTML Forms

<input /> type

• “password” fills text box with “*”, sends info to server• “checkbox”

Assigned individually Groups with same name Must have different value so server can identify

them.

Page 19: Xhtml Part2

More Complex XHTML Forms

<input /> Form3.html

“radio” radio button Only one in a group can be selected at a given time Attribute checked=”checked” sets default selection Name must be the same for all radio buttons in a

group

Page 20: Xhtml Part2

More Complex XHTML Forms

<select> </select> element• Dropdown list from which to select item• Attributes

name <option></option>

• Attributes selected = “selected” sets the default option

Page 21: Xhtml Part2

Internal Linking

Enables user to jump between locations in the same document.

Useful for long documents Eliminates scrolling links.html use id = “name” in a text element to create hyperlink

destination Use <a href =”#linkname”>directions </a> href = “filename.html#id”

links to an anchor on another page

Page 22: Xhtml Part2

Creating and Using Image Maps

Image maps create hyperlink spots on an image called “hotspots.”

picture.html

current browsers do not support XHTML 1.1, so use XHTML 1.0 Transitional note <!DOCTYPE…

Page 23: Xhtml Part2

Creating and Using Image Maps

picture.html

<map> </map> element image map definition Attribute

• id = “mapname”

Page 24: Xhtml Part2

Creating and Using Image Maps

picture.html

<area /> element defines the hotspot Attributes

• href specifies hyperlink• shape specifies the shape

rect rectangular shape poly polygon shape circle circle shape

• alt text to be displayed on mouseover• coords the coordinates in pixels

Page 25: Xhtml Part2

Creating and Using Image Maps

picture.html

<img /> element add attribute usemap = “mapname”