Download Obj ti /O tli Objectives/Outline

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

URL shortening wikipedia , lookup

Cascading Style Sheets wikipedia , lookup

URL redirection wikipedia , lookup

Transcript
WEB ENGINEERING &
Obj
ti /O tli
Objectives/Outline
DEVELOPMENT
SWE 363
y
Objectives
◦ …
◦ Create pages that have
frames
◦ Create pages that have
forms to collect user inputs
Spring Semester 2008-2009 (082)
Module 2-1-2:
p Languages
g g & HTML
Markup
◦ Use meta data to improve
search engine results and to
redirect a user
Computer Science Department
King Fahd University of Petroleum and Minerals
alfy@kfupm edu sa
[email protected]
KFUPM-082© Dr. El-Alfy
Frames
¾
¾
¾
¾
Allow the browser window to be divided into an independent set of
frames
More than one HTML document can be displayed in the same
browser window
Frequently used to add a menu bar to a web site where the constant
back and forth clicking would become tedious in a single page.
Allow easier navigation under some circumstances
The designer can divide the window horizontally and vertically in
various ways, e.g.
x Frames
x Forms
x Head Element
x Meta data
x <!DOCTYPE> tag
SWE 363 Web Engineering & Development
2.1.2.2
¾ The
<frameset> tag
◦ Defines
D f
how
h
to divide
d d the
h window
d
into frames
f
◦ Each frameset defines a set of rows or columns
◦ The
Th values
l
off the
h rows/columns
/ l
indicate
i di
the
h amount off
screen area each row/column will occupy
¾ The
<frame> tag
◦ Defines what HTML document to put into each frame
◦ The web developer must keep track of many HTML documents
◦ It is difficult to print/bookmark the entire page
SWE 363 Web Engineering & Development
tips
i
◦ If a frame has visible borders, the user can resize it by
dragging the border
◦ To prevent a user from resizing a frame, add
noresize="noresize"
noresize
noresize to the <frame> tag
◦ Add the <noframes> tag for browsers that do not support
frames
The disadvantages of using frames are:
KFUPM-082© Dr. El-Alfy
◦ …
◦ HTML Elements
Frames (cont.)
¾ Useful
U f l
¾
Outline
◦ Use the <!DOCTYPE> to
declare the DTD
Dr. El
El-Sayed
Sayed El
El-Alfy
Alfy
¾
y
2.1.2.3
KFUPM-082© Dr. El-Alfy
SWE 363 Web Engineering & Development
2.1.2.4
Examples
Examples (cont.)
No <body>
element
l
t
<html>
<frameset rows="50%,50%">
<frame src="tryhtml_frame_a.htm">
<frameset cols="25%,75%">
<frame src="tryhtml_frame_b.htm">
<frame src="tryhtml_frame_c.htm">
</frameset>
</html>
/h l
SWE 363 Web Engineering & Development
<html>
<frameset
cols="120,*">
f
l "120 *"
<frame src="tryhtml_contents.htm">
<frame src="tryhtml_frame_a.htm“ name="showframe">
</frameset>
/frameset
</html>
Only to be displayed in
<html>
browsers that are not
<frameset cols="15%,85%">
able to show frames
<frame src="menu_bar.htm" name="sidemenu">
<frame src="main.htm" name="mainwindow">
</frameset>
<noframes>
Your browser does not support frames.
<a href="frameless_main.htm">Please visit the frameless
page.</a>
/
</noframes>
</html>
</frameset>
KFUPM-082© Dr. El-Alfy
Name the frame and use target
attribute in the <a> element to
specify where to load the page
2.1.2.5
Frames Attributes
KFUPM-082© Dr. El-Alfy
SWE 363 Web Engineering & Development
2.1.2.6
Inline Frame
¾ The
iframe element creates an inline frame that
contains another document (a frame inside an
p g )
HTML page)
Attribute
Value
Description
align
left
right
top
middle
bottom
Specifies how to align the iframe according to the
surrounding text
frameborder
1
0
Specifies whether or not to display a frame border
height
pixels
%
Defines the height of the iframe
longdesc
URL
A URL to a long description of the frame contents
marginheight
pixels
Defines the top and bottom margins of the iframe
marginwidth
pixels
Defines the left and right margins of the iframe
name
frame_name
Specifies a unique name of the iframe (to use in
scripts)
scrolling
yes
no
auto
Define scroll bars
src
URL
The URL of the document to show in the iframe
width
pixels
%
Defines the width of the iframe
<html>
<body>
<iframe
src ="/default.asp">
</iframe>
<p>
Some older browsers don
don't
t
support iframes. If they
don't, the iframe will not
be visible.
</p>
/body
</body>
</html>
KFUPM-082© Dr. El-Alfy
SWE 363 Web Engineering & Development
2.1.2.7
KFUPM-082© Dr. El-Alfy
SWE 363 Web Engineering & Development
2.1.2.8
Forms
Example
¾ Forms
are used to collect different input data from a
user
¾ A form is an area that can contain form elements
<form>
First
name: <input
type="text"
i
i
"
" name="firstname">
"fi
" <br>
b
Last name: <input type="text" name="lastname">
</form>
◦ like text fields, textarea, drop-down menus, radio buttons,
checkboxes, etc.
¾A
form
f
is
i defined
d fi d with
ith the
th <form>
<f
> tag
t
<form> … … … … … </form>
¾ The
<input> tag is the most used element
◦ The type of input is specified with the type attribute:
x
x
x
x
Text Fields
R di Buttons
Radio
B
Checkboxes
Drop Lists
KFUPM-082© Dr. El-Alfy
SWE 363 Web Engineering & Development
2.1.2.9
Examples (cont.)
SWE 363 Web Engineering & Development
SWE 363 Web Engineering & Development
2.1.2.10
Forms (cont.)
<form>
First
name: <input
type="text“
i
i
"
“ name="firstname">
"fi
" <br>
b
Last name: <input type="text" name="lastname">
<input type="radio" name="sex" value="male" checked> Male<br>
<input
input type
type="radio"
"radio" name="sex"
name "sex" value="female">
value "female" Female
<input type="checkbox" name="bike"> I have a bike <br>
<input type="checkbox" name="car"> I have a car
<select name=
name="cars">
cars >
<option value="volvo">Volvo
<option value="saab">Saab
<option value=
value="fiat">Fiat
fiat >Fiat
<option value="audi">Audi
</select>
<textarea rows
rows="10"
10 cols
cols="30">
30 >
</textarea>
</form>
KFUPM-082© Dr. El-Alfy
KFUPM-082© Dr. El-Alfy
2.1.2.11
¾ To
send the form content to the server
◦ The form's action attribute defines the name of the file
to send the content to
◦ The “Submit" button is used to allow the user to
p
activate the send process
<form name="input" action="html_form_action.asp" method="get">
Username: <input type="text" name="user">
p
type=“Submit"
yp
value="Submit">
<input
</form>
KFUPM-082© Dr. El-Alfy
SWE 363 Web Engineering & Development
2.1.2.12
Example: Send ee-mail from a form
The <head> element
<form action="MAILTO:[email protected]" method="post"
enctype="text/plain">
<h3>This form sends an e-mail to W3Schools.</h3>
Name:<input type="text" name="name“ value="yourname"
size="20“><br>
Mail:<input type="text" name="mail” value="yourmail"
size="20“> <br>
Comment:<input
i
type="text"
"
" name="comment”
"
” value="yourcomment"
l
"
"
size="40"> <br><br>
<input type
type="submit"
"submit" value="Send">
value "Send">
<input type="reset" value="Reset">
¾ The
head element contains general information
(meta-information)
(
i f
i ) about
b
a document
d
◦ Using this is optional, but recommended.
¾ Head
tags
◦ <title>: defines the document title
<title>Web Design</title>
◦ <base>: defines a base URL for all the links
<base href="http://www.w3schools.com/images/" />
◦ <link>: defines a resource reference
</form>
<link rel="stylesheet" type="text/css" href="theme.css" />
◦ <meta>: defines meta information about yyour page,
p g
such as descriptions and keywords for search engines
and refresh rates
KFUPM-082© Dr. El-Alfy
SWE 363 Web Engineering & Development
2.1.2.13
Meta tags
SWE 363 Web Engineering & Development
2.1.2.14
Example
¾ Improving
Search Engine Results: This gives you more
control over how your page will show up during a
search
◦ Document description:
p
Information inside a meta element
describes the document.
<meta name="description" content="description
of page goes here">
here >
◦ Document keywords: Information inside a meta element
d
describes
ib th
the document's
d
t' keywords.
k
d
<meta name="keywords" content="keywords
go here">
e e
¾ Redirect
KFUPM-082© Dr. El-Alfy
<html>
<head>
<title>Little Joe's Sound Page</title>
<meta name=
name="description"
description content="Joe's
content= Joe s Collection of Cool
Sound files for you to use in your home page!">
<meta name="keywords" content="music sounds midi wav joe
collection >
collection">
</head>
<body>
Page Goes Here
</body>
</html>
a user (auto-refreshing):
◦ Redirect a user if the site address has changed
g
◦ Refresh the document to update the data
¾ Controlling
g
KFUPM-082© Dr. El-Alfy
indexing/following
g
g links on your
y
page
p g
SWE 363 Web Engineering & Development
2.1.2.15
KFUPM-082© Dr. El-Alfy
SWE 363 Web Engineering & Development
2.1.2.16
Meta Tags: Automatic Refreshing
Meta Tag: Controlling Page Indexing
Auto refreshing means that once one page loads, you can set a
certain number of seconds and then the browser will load another
page automatically.
¾ Supported by popular web browsers
¾ The basic structure is as follows:
¾
¾
<meta name=“robots" content=“text">
where text can be any one of the following:
<meta http-equiv="refresh" content="x_seconds;
url http://www.yourhost.com/pagetosendto.html >
url=http://www.yourhost.com/pagetosendto.html">
◦ http-equiv="refresh"
http-equiv= refresh tells that this is the refresh meta tag
tag.
◦ Content gives the number of seconds to wait before refreshing and the URL
of the page to load
¾
You can use the following meta tag to control which pages to be
indexed by all search engines and which to be crawled
all
index,follow
Same as index,follow.
The default, meaning index the page and follow all links from the page.
noindex, follow
don't
' index the page but do follow all links from the page.
index,nofollow
index the page, but do not proceed to the links from the page.
noindex,nofollow
do not index the page and do not proceed to links from the page.
none
noimageindex
same as noindex,nofollow.
Altavista only. Prevents the images on the page from being indexed, but
the text on the page can still be indexed. May be included index,
noindex, follow and nofollow.
Example: refresh to davesite.com after 5 seconds
¾
<meta
<
t htt
http-equiv="refresh"
i " f
h" content="5;
t t "5
URL=http://www.davesite.com/">
¾
You can also control a specific
p
engine
g byy changing
g g the name value
Examples
<meta name=“robots" content=“noindex, nofollow">
<meta name=“googlebot” content=“noindex”>
KFUPM-082© Dr. El-Alfy
SWE 363 Web Engineering & Development
2.1.2.17
HTML <!DOCTYPE> Tag
¾
KFUPM-082© Dr. El-Alfy
SWE 363 Web Engineering & Development
2.1.2.18
HTML <!DOCTYPE> Tag (cont.)
The <DOCTYPE> declaration must be the very first
thing in a document, before the <html>
html tag
¾ Strict
◦ Has no closing tag
Used to tell the browser what version of HTML or
XHTML is used by the document; i.e. Document Type
Definition (DTD) which is the grammar of the markup
language
¾ HTML 4.01 specifies three document types:
¾
◦ Strict DTD:
DTD:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www
http://www.w3.org/TR/html4/strict.dtd
w3 org/TR/html4/strict dtd">
>
¾ Transitional
T
iti l
DTD
DTD:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD
" //W3C//DTD HTML 4.01
4 01
Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
x Use this when you want clean markup, free of presentational clutter
x Used together with Cascading Style Sheets (CSS)
◦ Transitional DTD:
x Used when HTML presentational features are included in the document
instead of in a style sheet;
x To accommodate older browsers that don
don'tt support CSS
◦ Frameset DTD:
x Used for documents with frames; is equal to the Transitional DTD except
for the frameset element replaces the body element
KFUPM-082© Dr. El-Alfy
SWE 363 Web Engineering & Development
2.1.2.19
¾ Frameset
DTD
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Frameset//EN" "http://www
Frameset//EN
http://www.w3.org/TR/html4/frameset.dtd
w3 org/TR/html4/frameset dtd">
>
KFUPM-082© Dr. El-Alfy
SWE 363 Web Engineering & Development
2.1.2.20
Q &A
References
¾
Some useful links with examples and other resources:
◦ Internet and World Wide Web How to Program, 4/e, H. M. Deitel, P. J.
Deitel, and A. B. Goldberg, Pearson Education Inc., 2008. Chapter 4.
◦ W
Webb Development
D l p
t andd Design
D i Foundations
F d ti
with
ith XHTML
XHTML, 4/e,
4/ Pearson
P
Education Inc. 2009. Chapter 2.
http://en wikipedia org/wiki/List of document markup languages
◦ http://en.wikipedia.org/wiki/List_of_document_markup_languages
◦ W3C at http://www.w3.org/html/
◦ W3Schools at http://www.w3schools.com/
http://www w3schools com/
x http://www.w3schools.com/html/
◦ http://www.boutell.com/mapedit
p
p
◦ HTML Tutorial
http://www.davesite.com/webstation/html/index.shtml
◦ For a full description of meta tags refer to http://www.htmlreference.com/META.htm
KFUPM-082© Dr. El-Alfy
SWE 363 Web Engineering & Development
2.1.2.21
KFUPM-082© Dr. El-Alfy
SWE 363 Web Engineering & Development
2.1.2.22