Web-based Application Development Lecture 9 February 7, 2006 Anita Raja.

32
Web-based Application Development Lecture 9 February 7, 2006 Anita Raja
  • date post

    19-Dec-2015
  • Category

    Documents

  • view

    214
  • download

    0

Transcript of Web-based Application Development Lecture 9 February 7, 2006 Anita Raja.

Page 1: Web-based Application Development Lecture 9 February 7, 2006 Anita Raja.

Web-based Application Development

Lecture 9

February 7, 2006

Anita Raja

Page 2: Web-based Application Development Lecture 9 February 7, 2006 Anita Raja.

Programming the Web using XHTML and JavaScript

Chapter 6

Web Page Design and Layout

Page 3: Web-based Application Development Lecture 9 February 7, 2006 Anita Raja.

Layout with Style Normal flow

Page elements are interpreted: Top to bottom Left to right

Can control some placement with float property or align attribute

position property of style sheets provides specific placement information

Page 4: Web-based Application Development Lecture 9 February 7, 2006 Anita Raja.

Layout with Style

<style type=”text/css”>

img.tower {position:absolute; top:75;

left:150}

</style>

Page 5: Web-based Application Development Lecture 9 February 7, 2006 Anita Raja.

Layout with Style

<img class=“img.tower” src=“eiffel.jpg” />

Ch06-Ex-01.html

Page 6: Web-based Application Development Lecture 9 February 7, 2006 Anita Raja.

Layout with Style Placement is relative to containing block Could place image inside a paragraph that

was itself positioned at some absolute set of coordinates

Caution – using position removes the image from the normal flow but not anything else!

Ch06-Ex-02.html

Page 7: Web-based Application Development Lecture 9 February 7, 2006 Anita Raja.

Layout with Style Magazine style

Set height and width for most current monitors:

Height = 400-500 pixels Width = 600 pixels No scrolling required

See Figures 6.1 & 6.2, p. 144-145

Page 8: Web-based Application Development Lecture 9 February 7, 2006 Anita Raja.

Title

Image

Column 1 Column 2

Column 3

600 pixels

500 pixels

Page 9: Web-based Application Development Lecture 9 February 7, 2006 Anita Raja.

Layout with Style Use <div> element Define a custom block-level element for

each section of the layout

Page 10: Web-based Application Development Lecture 9 February 7, 2006 Anita Raja.

Layout with Style

<style type=“text/css”> div.title {…} div.image {…} div.col1 {…} div.col2 {…} div.col3 {…}</style>

Page 11: Web-based Application Development Lecture 9 February 7, 2006 Anita Raja.

Layout with Style<style type=“text/css”> div.title {position:absolute; top:0; left:0; height:60; width:600}</style>

…<div class=“title”> … </div>…

Page 12: Web-based Application Development Lecture 9 February 7, 2006 Anita Raja.

Layout with Style Ch06-Ex-03.html padding – number of pixels between

border and text (padding n or padding x y) overflow – whether or not text outside the

borders is visible hidden visible

Ch06-Ex-03a.html

Page 13: Web-based Application Development Lecture 9 February 7, 2006 Anita Raja.

Tables Nested tables Insert <table>…</table> within an

existing <td>…</td> element

Page 14: Web-based Application Development Lecture 9 February 7, 2006 Anita Raja.

Tables<table>

<tr> <td> </td> <td> </td>

</tr></table>

<table><tr>

<td> </td> <td> </td>

</tr></table>

Page 15: Web-based Application Development Lecture 9 February 7, 2006 Anita Raja.

Tables Plain table

Ch06-Ex-04.html

Nested table Ch06-Ex-05.html

Page 16: Web-based Application Development Lecture 9 February 7, 2006 Anita Raja.

Frames Divide window into separate sections

like <div> Each section displays the contents of a

separate HTML document Frames may:

Have scroll bars Be resized

Page 17: Web-based Application Development Lecture 9 February 7, 2006 Anita Raja.

Frames First define a layout or frameset document:

<html>

<head>

</head>

<frameset>

</frameset>

</html>

Page 18: Web-based Application Development Lecture 9 February 7, 2006 Anita Raja.

Frames Define structure using the frameset

element rows attribute cols attribute

Units are: Percentage of window size Number of pixels Relative value

Page 19: Web-based Application Development Lecture 9 February 7, 2006 Anita Raja.

Frames Percentage of window size:

<frameset rows=“30%, 40%, 30%”>

</frameset> Number of pixels:

<frameset cols=“80, 160, 50”>

</frameset>

Page 20: Web-based Application Development Lecture 9 February 7, 2006 Anita Raja.

Frames Relative value:

<frameset cols=“80, *, 80”>

</frameset>

Page 21: Web-based Application Development Lecture 9 February 7, 2006 Anita Raja.

Frames Frames can be nested

<frameset cols=“50%, 50%”>

</frameset>

<frameset rows=“50%, 50%”></frameset><frameset rows=“33%, 33%, 33%”></frameset>

Page 22: Web-based Application Development Lecture 9 February 7, 2006 Anita Raja.

Frames <frameset> only specifies structure, not

content Content requires a <frame /> tag Each <frame /> tag may have seven

attributes

Page 23: Web-based Application Development Lecture 9 February 7, 2006 Anita Raja.

Frames src – The URL of the HTML document

that will appear in the frame id – Assigns a name to the frame so it

can be referenced by links in other frames

marginwidth and marginheight – The size in pixels of the frame’s margins

Page 24: Web-based Application Development Lecture 9 February 7, 2006 Anita Raja.

Frames scrolling

yes – The frame will always have scroll bars no – The frame will never have scroll bars auto – The frame lets the browser decide

noresize – The user cannot drag the frame edges to resize the frame

frameborder=0 – hides the frame’s borders

Page 25: Web-based Application Development Lecture 9 February 7, 2006 Anita Raja.

Frames Include one <frame> tag for each frame:

<frameset rows=“50%, 50%”> <frame id=“upper” src=“fred.html” /> <frame id=“lower” src=“sam.html”/></frameset>

Ch06-Ex-07.html

Page 26: Web-based Application Development Lecture 9 February 7, 2006 Anita Raja.

Frames <noframes> element in case user’s

browser doesn’t support frames:

<frameset …> <frame …> <noframes>This Web page …

</noframes></frameset>

Page 27: Web-based Application Development Lecture 9 February 7, 2006 Anita Raja.

Frames Refresh/Reload button:

Reloads frame(s) contents but Does not reload the layout (<frameset>)

document To reload a <frameset> have to use

menu: File, Open, etc.

Page 28: Web-based Application Development Lecture 9 February 7, 2006 Anita Raja.

Frames

Linking between frames: Click link in one frame See result in another frame

Add target attribute to <a> tag:<a href=“…” target=“left_frame”>

Click here to …

</a> Otherwise content appears in current frame Ch06-Ex-08

Page 29: Web-based Application Development Lecture 9 February 7, 2006 Anita Raja.

Frames

Eliminating frames Frameset hierarchy

Browser tracks framesets Browser window is at the “top” First <frameset> defined is “down” one level …

Browser window

1st frameset

Page 30: Web-based Application Development Lecture 9 February 7, 2006 Anita Raja.

Frames Can set target to _top:

<a href=“…” target=“_top”>…</a>

Ch06-Ex-10

Page 31: Web-based Application Development Lecture 9 February 7, 2006 Anita Raja.

Multiple Windows Just like specifying what frame in which

to display a document:

<a href=“…” target=“fred”> … </a>

Ch06-Ex-11

Page 32: Web-based Application Development Lecture 9 February 7, 2006 Anita Raja.

Assignment Debugging Exercise, p. 174 Correct errors Post corrected document to your Web

space as “Lagerstrom-Ch-6.html” Grade based on:

Appearance Technical correctness of code