HTML and Web Pages - Marquette University

download report

Transcript HTML and Web Pages - Marquette University

Background and Forms
Background - body
To embed background into a whole page
<body background="tile.gif">
If the picture is smaller than the screen size, it will "tile"
Background - body
To embed background into a whole page
If the picture is a "verticular" image. Because it is "tiling", it
gives an illusion of a fading background.
Background - table
Similarly to putting an image on the background,
you can put one inside a cell.
<TABLE border="1" width="600" height="400">
<TD width="300" background="blue.gif"></TD>
<TD width="300" background="brown.gif"></TD>
Exercise 5
Create ex5 directory inside public_html
Inside ex5
Create home.html – do this first as template
Create projects.html
Goodies: If you want to scale down a large
image, just define the width size and the
browser will automatically resize the picture
eg. <img src="pic.gif" width="100">
HTML Forms
 Receive information from the web surfer
 A form will take input from the viewer
Text Fields
 Input fields are going to be the meat of your form's sandwich.
The <input> has a few attributes that you should be aware of.
 type - Determines what kind of input field it will be. Possible
choices are text, submit, and password.
 name - Assigns a name to the given field so that you may
reference it later.
 size - Sets the horizontal width of the field. The unit of
measurement is in blank spaces.
 maxlength - Dictates the maximum number of characters that
can be entered.
Forms – Introduction
<form method="post" action="mailto:[email protected]">
Name: <input type="text" size="10" maxlength="40"
name="name"> <br />
Favorite Drink: <input type="text" size="10" maxlength="20"
name="message"><br />
<input type="submit" value="SEND">
method - We will only be using the post functionality of method,
which sends the data without displaying any of the information
to the visitor.
action - Specifies the URL to send the data to.
Forms – Radio Buttons
<form method="post" action="mailto:[email protected]">
What kind of shirt are you wearing? <br />
<input type="radio" name="shade" value="dark">Dark
<input type="radio" name="shade" value="light">Light <br />
<input type="radio" name="size" value="small">Small
<input type="radio" name="size" value="medium">Medium
<input type="radio" name="size" value="large">Large <br />
<input type="submit" value=“SEND">
value - specifies what will be sent if the user chooses this radio button.
Only one value will be sent for a given group of radio buttons (see
name for more information, if the name is the same, you allow only
one option. If name is different, you allow multiple option).
name - defines which set of radio buttons that it is a part of. Here, we
have 2 groups: shade and size.
Forms – Check Boxes (check all
<form method="post"
action="mailto:[email protected]">
Select your favorite cartoon characters.
<input type="checkbox" name="toon1"
<input type="checkbox" name="toon2"
<input type="checkbox" name="toon3"
value="Bugs">Bugs Bunny
<input type="checkbox" name="toon4"
value="Scoob">Scooby Doo
<input type="submit" value="SUBMIT">
Forms – Drop down lists
<form method="post“ action="mailto:[email protected]">
College Degree?
<select name="degree">
<option>Choose One</option>
<option>Some High School</option>
<option>High School Degree</option>
<option>Some College</option>
<option>Bachelor's Degree</option>
<input type="submit" value="SEND">
Forms – Selection Forms
<form method="post"
action="mailto:[email protected]">
Musical Taste
<select multiple name="music" size="4">
<option value="metal/rock" >Metal/Rock</option>
<option value="hiphop" >Hip Hop</option>
<option value="classical" >Classical</option>
<option value="alternative" >Alternative</option>
<input type="submit" value="SEND">
Forms – Text Area
<form method="post"
action="mailto:[email protected]">
<textarea rows="5" cols="20" name="comments">
Enter Comments Here
<input type="submit" value="SEND">
Rows and columns need to be specified as attributes to
the <textarea> tag. Rows are roughly 12pixels high, the
same as in word programs and the value of the columns
reflects how many characters wide the text area will be.
i.e. The example shows a text area 5 rows tall and
20 characters wide.