Lecture 6 More Advanced XHTML - PowerPoint PPT Presentation

1 / 26
About This Presentation
Title:

Lecture 6 More Advanced XHTML

Description:

Some cells have row or column labels and some have data ... Reset clears all controls to their initial states. Submit has two actions: ... – PowerPoint PPT presentation

Number of Views:31
Avg rating:3.0/5.0
Slides: 27
Provided by: SteveB178
Category:

less

Transcript and Presenter's Notes

Title: Lecture 6 More Advanced XHTML


1
Lecture 6More Advanced XHTML
  • Boriana Koleva
  • Room C54
  • Email bnk_at_cs.nott.ac.uk

2
Overview
  • Tables
  • Forms
  • Frames

3
Tables
  • A table is a matrix of cells
  • The cells can include almost any element
  • Some cells have row or column labels and some
    have data
  • A table is specified as the content of a lttablegt
    tag
  • Each row of a table is specified as the content
    of a lttrgt tag
  • The row headings are specified as the content of
    a ltthgt tag
  • Each data cell of a row is specified as the
    content of a lttdgt tag

4
Table Basic Formatting
  • A border attribute in the lttablegt tag specifies a
    border between the cells
  • If border is set to "border", the browsers
    default width border is used
  • The border attribute can be set to a number,
    which will be the border width
  • E.g. border 4
  • Without the border attribute, the table will have
    no lines!
  • Tables are given titles with the ltcaptiongt tag,
    which can immediately follow lttablegt

5
Table Example
  • lttable border "border"gt
  • ltcaptiongtPrice of Fruitlt/captiongt
  • lttrgt
  • ltthgtFruitlt/thgt
  • ltthgtPricelt/thgt
  • lt/trgt
  • lttrgt
  • lttdgtApplelt/tdgt
  • lttdgt0.20lt/tdgt
  • lt/trgt
  • lttrgt
  • lttdgtOrangelt/tdgt
  • lttdgt0.50lt/tdgt
  • lt/trgt
  • lt/tablegt

http//www.cs.nott.ac.uk/bnk/WPS/table.html
6
rowspan and colspan attributes
  • Table cells are sized to fit the data they
    contain
  • You can create larger data cells by using these
    attributes
  • rowspan set in the ltthgt or lttdgt tag to specify
    that the cell must span some number of rows
  • colspan set in the ltthgt or lttdgt tag to specify
    that the cell must span some number of columns
  • http//www.cs.nott.ac.uk/bnk/WPS/cell_span.html

7
align and valign attributes
  • The align attribute controls the horizontal
    placement of the contents in a table cell
  • Values are left, right, and center
  • Default for labels is center, for data it is left
  • align is an attribute of lttrgt, ltthgt, and lttdgt
    elements
  • The valign attribute controls the vertical
    placement of the contents of a table cell
  • Values are top, bottom, and center (default)
  • valign is an attribute of ltthgt and lttdgt elements

http//www.cs.nott.ac.uk/bnk/WPS/cell_align.html
8
cellpadding and cellspacing attributes
  • The cellspacing attribute of lttablegt is used to
    specify the distance between cells in a table
  • The cellpadding attribute of lttablegt is used to
    specify the spacing between the content of a cell
    and the inner walls of the cell
  • lttable cellspacing "50"gt
  • lttrgt
  • lttdgt Colorado is a state of
  • lt/tdgt
  • lttdgt South Dakota is somewhat
  • lt/tdgt
  • lt/trgt
  • lt/tablegt

http//www.cs.nott.ac.uk/bnk/WPS/cell_pad.html
9
Table Sections
  • Tables naturally occur in two and sometimes three
    parts
  • Header lttheadgt
  • First section, contains header information such
    as column names
  • Body lttbodygt
  • Tables primary data
  • If a document has multiple tbody elements, they
    are separated by thicker horizontal lines
  • Footer lttfootgt
  • E.g. for calculation results and footnotes

10
Forms
  • A form is the usual way information is
    communicated from a browser to a server
  • HTML has tags to create a collection of objects
    that implement this information gathering
  • These objects are called controls or widgets
    (e.g., radio buttons and checkboxes)
  • When the Submit button of a form is clicked, the
    forms values are sent to the server

11
The ltformgt Tag
  • All of the components (widgets) of a form are
    defined in the content of a ltformgt tag
  • The only required attribute of ltformgt is action
  • specifies the URL of the application that is to
    be called when the Submit button is clicked
  • action "http//www.cs.nott.ac.uk/cgi-bin/survey.
    pl"
  • if the form has no action, the value is set to
    the empty string ( )
  • The method attribute of ltformgt specifies one of
    the two possible techniques of transferring the
    form data to the server, get and post

12
The ltinputgt Tag
  • Many controls are created with the ltinputgt tag
  • The type attribute of ltinputgt specifies the kind
    of control being created
  • Text
  • Creates a horizontal box for text input
  • Default size is 20 characters it can be changed
    with the size attribute
  • If more characters are entered than will fit, the
    box is scrolled (shifted) left
  • maxlength max number of characters
  • ltinput type "text" name "Phone" size "12"
    gt

13
The ltinputgt Tag
  • Password
  • type password
  • Only bullets or asterisks displayed by browser
  • Checkboxes to collect multiple choice input
  • Every checkbox requires a value attribute, which
    is the widgets value in the form data when the
    checkbox is checked
  • A checkbox that is not checked contributes no
    value to the form data
  • By default, no checkbox is initially checked
  • To initialize a checkbox to checked, the
    checked attribute must be set to "checked"

http//www.cs.nott.ac.uk/bnk/WPS/checkbox.html
14
The ltinputgt Tag
  • Radio Buttons - collections of checkboxes in
    which only one button can be checked at a
    time
  • Every button in a radio button group MUST have
    the same name
  • If no button in a radio button group is selected
    the browser often selects the first one

http//www.cs.nott.ac.uk/bnk/WPS/radio.html
15
The ltselectgt Tag - Menus
  • There are two kinds of menus
  • those that behave like checkboxes and
  • those that behave like radio buttons (the
    default)
  • Menus that behave like checkboxes are specified
    by including the multiple attribute, which must
    be set to "multiple"
  • The name attribute of ltselectgt is required

16
The ltselectgt Tag - Menus
  • The size attribute of ltselectgt can be included to
    specify the number of menu items to be displayed
    (the default is 1)
  • If size is set to gt 1 or if multiple is
    specified, the menu is displayed as a scrolled
    list
  • Each item of a menu is specified with an ltoptiongt
    tag
  • whose pure text content (no tags) is the value of
    the item
  • An ltoptiongt tag can include the selected
    attribute, which when assigned "selected"
    specifies that the item is pre-selected

http//www.cs.nott.ac.uk/bnk/WPS/menu.html http/
/www.cs.nott.ac.uk/bnk/WPS/menu2.html
17
The lttextareagt Tag
  • Creates a multiline text area
  • Usually include the rows and cols attributes to
    specify the size of the text area
  • Default text can be included as the content of
    lttextareagt
  • Scrolling is implicit if the area is overfilled

http//www.cs.nott.ac.uk/bnk/WPS/textarea.html
18
Submit and Reset Buttons
  • Both are created with ltinputgt
  • ltinput type "reset" value "Reset Form"gt
  • ltinput type "submit value "Submit Form"gt
  • Reset clears all controls to their initial states
  • Submit has two actions
  • Encode the data of the form
  • Request that the server execute the
    server-resident program specified as the value of
    the action attribute of ltformgt
  • A Submit button is required in every form

Complete form http//www.cs.nott.ac.uk/bnk/WPS/p
opcorn.html
19
Frames
  • Frames are rectangular sections of the display
    window, each of which can display a different
    document
  • Uses of frames
  • Navigation systems (table of contents)
  • Static title
  • Commentaries
  • Advertising
  • Because frames are no longer part of XHTML, you
    cannot validate a document that includes frames

20
Framesets
  • The ltframesetgt tag specifies the number of frames
    and their layout in the window
  • ltframesetgt takes the place of ltbodygt
  • Cannot have both!
  • ltframesetgt must have either a rows attribute or
    a cols attribute, or both (usually the case)
  • The possible values for rows and cols are
  • numbers size in pixels
  • percentages of total browser window size
  • asterisks remainder of window

21
Framesets
  • Examples
  • ltframeset rows "150, 200, 300"gt
  • ltframeset rows "25, 50, 25"gt
  • ltframeset rows "50, 20, " gt
  • ltframeset rows "50, 25, 25"
  • cols "40, "gt

22
Frame tag
  • The ltframegt tag specifies the content of a frame
  • The first ltframegt tag in a ltframesetgt specifies
    the content of the first frame, etc.
  • Row-major order is used
  • Frame content is specified with the src attribute
  • Without a src attribute, the frame will be empty
    (such a frame CANNOT be filled later)
  • If ltframesetgt has fewer ltframegt tags than frames,
    the extra frames are empty

http//www.cs.nott.ac.uk/bnk/WPS/frames.html
23
Frame tag
  • Note the Frameset standard must be specified in
    the DOCTYPE declaration
  • Scrollbars are implicitly included if needed
  • if the specified document will not fit
  • If a name attribute is included, the content of
    the frame can be changed later (by selection of a
    link in some other frame)

http//www.cs.nott.ac.uk/bnk/WPS/contents.html ht
tp//www.cs.nott.ac.uk/bnk/WPS/fruits.html
24
Nested Frames
  • Nested frames - to divide the screen in more
    interesting ways

http//www.cs.nott.ac.uk/bnk/WPS/nested_frames.ht
ml
25
Problems with Frames
  • Frames break the fundamental paradigm of the web
  • The page is the basic unit of the web
  • Each page is represented by a URL
  • With Frames the URL represents a Frameset rather
    than a page
  • This causes problems
  • Bookmarks and Trails dont work
  • Printing is unpredictable and dependent upon the
    browser
  • Links to Frames (rather than Framesets) may be
    difficult to navigate
  • Links to Framesets inside Frames may be illegible
  • Links may become recursive

26
Summary
  • Tables
  • Forms
  • Frames
Write a Comment
User Comments (0)
About PowerShow.com