26
Introduction to HTML Part 3 Chapter 2

Introduction to HTML Part 3 Chapter 2. Learning Outcomes Identify how to design frames. Explain frames’ attributes. Describe the method on designing forms

Embed Size (px)

Citation preview

Page 1: Introduction to HTML Part 3 Chapter 2. Learning Outcomes Identify how to design frames. Explain frames’ attributes. Describe the method on designing forms

Introduction to HTML

Part 3

Chapter 2Chapter 2

Page 2: Introduction to HTML Part 3 Chapter 2. Learning Outcomes Identify how to design frames. Explain frames’ attributes. Describe the method on designing forms

Learning Outcomes

Identify how to design frames. Explain frames’ attributes. Describe the method on designing forms on

web page: Textbox, Password box, Checkbox, Radio Button, Drop-down menu, Submit & Reset Button

Page 3: Introduction to HTML Part 3 Chapter 2. Learning Outcomes Identify how to design frames. Explain frames’ attributes. Describe the method on designing forms

2.3.1 Frames

Allow you to divide into sub-windows. Content of each frame can be independent. Enable you to display more than one web

page at a time. Two types :

Horizontal Vertical

At least three documents needed to create a frame

Page 4: Introduction to HTML Part 3 Chapter 2. Learning Outcomes Identify how to design frames. Explain frames’ attributes. Describe the method on designing forms

Defining Frames

<frameset> and </frameset> tags are used to set the frame type and space (in pixels or percentage)

<frame> set which HTML file to display and assign name for targeting purposes.

<noframe> display information for browsers that do not support frame function. If you do include this the browser won’t display anything.

Page 5: Introduction to HTML Part 3 Chapter 2. Learning Outcomes Identify how to design frames. Explain frames’ attributes. Describe the method on designing forms

Creating Horizontal Frame

<html>

<frameset rows="25%,50%,25%">

<frame src="frame_a.htm" />

<frame src="frame_b.htm" />

<frame src="frame_c.htm" />

</frameset>

</html>

Page 6: Introduction to HTML Part 3 Chapter 2. Learning Outcomes Identify how to design frames. Explain frames’ attributes. Describe the method on designing forms

Creating Vertical Frame

<html>

<frameset cols="25%,50%,25%">

<frame src="frame_a.htm" />

<frame src="frame_b.htm" />

<frame src="frame_c.htm" />

</frameset>

</html>

Page 7: Introduction to HTML Part 3 Chapter 2. Learning Outcomes Identify how to design frames. Explain frames’ attributes. Describe the method on designing forms

frameset attribute By default, user can manually resize the frame

size by dragging the border. You can add noresize attribute to disable resizing.

The frame border can also look ugly so to eliminate it you can add border=0 in the frameset tag.

By default, scrollbar will be automatically appear when you have more content than the frame area. You can either force the scrollbar to appear or disable it by applying scroll=“yes” or scroll=“no” attribute in the frameset tag.

Page 8: Introduction to HTML Part 3 Chapter 2. Learning Outcomes Identify how to design frames. Explain frames’ attributes. Describe the method on designing forms

Nested frame

Frames can be arranged in an interesting way by nesting them

Frame CFrame B

Frame A

Page 9: Introduction to HTML Part 3 Chapter 2. Learning Outcomes Identify how to design frames. Explain frames’ attributes. Describe the method on designing forms

<html><frameset rows="50%,50%">

<frame src="frame_a.htm" /> <frameset cols="25%,75%"> <frame src="frame_b.htm" /> <frame src="frame_c.htm" /> </frameset>

</frameset></html>

Nested frame

Page 10: Introduction to HTML Part 3 Chapter 2. Learning Outcomes Identify how to design frames. Explain frames’ attributes. Describe the method on designing forms

2.3.2 What is Forms …

Forms are a way to collect information from web users and transmit it back to web server.

The form is an HTML elements that display fields which user can enter information and then click a button to submit it.

Page 11: Introduction to HTML Part 3 Chapter 2. Learning Outcomes Identify how to design frames. Explain frames’ attributes. Describe the method on designing forms

…Continued

<form> and </form> tags are used to create a form.

action attribute provides URL or location of the server-side script that will process the data. You can also send the data to an e-mail address by inserting action=“mailto:[email protected]

<input> tags are added to create the fields for the users to enter information.

Page 12: Introduction to HTML Part 3 Chapter 2. Learning Outcomes Identify how to design frames. Explain frames’ attributes. Describe the method on designing forms

Elements in Forms

Text-entry fields Password fields Radio buttons Check boxes Drop-down menus Submit and Reset buttons

Page 13: Introduction to HTML Part 3 Chapter 2. Learning Outcomes Identify how to design frames. Explain frames’ attributes. Describe the method on designing forms

Textbox

Allows user to enter non formatted and/or non validated text

Example of use: Full name Address Phone No Email

<input type=“text” name=“phone” >

Page 14: Introduction to HTML Part 3 Chapter 2. Learning Outcomes Identify how to design frames. Explain frames’ attributes. Describe the method on designing forms

Textbox

size attribute determine the length of the textbox.

maxlength attribute the maximum number of character can be typed in a textbox.

<input type=“text” name=“Username” size=“25” maxlength=“10” >

Page 15: Introduction to HTML Part 3 Chapter 2. Learning Outcomes Identify how to design frames. Explain frames’ attributes. Describe the method on designing forms

Password box

Similar to textbox except that the characters is not revealed and replaced with asterisks.

<input type=“password” name=“Username” size=“25” maxlength=“10” >

Page 16: Introduction to HTML Part 3 Chapter 2. Learning Outcomes Identify how to design frames. Explain frames’ attributes. Describe the method on designing forms

Submit/Reset Buttons

Submit button is required. Form data will be transmitted to the server when

submit button is clicked. The value attribute will determine the label on the

buttons. Reset button will clear all form.

<input type="submit" value="Submit This Form“ >

<input type="reset" value="Clear Form and Start Over“ >

Page 17: Introduction to HTML Part 3 Chapter 2. Learning Outcomes Identify how to design frames. Explain frames’ attributes. Describe the method on designing forms

Creating a Login Form

<form action=””>

Username :

<input type = "text" name = "Username" size=”15” maxlength=”10” ><br>

Password :

<input type = "password" name = "Password" size=”15” maxlength=”10” ><br>

<input type = "submit" value=”Login”>

<input type = "reset" value=”Reset”>

</form>

Page 18: Introduction to HTML Part 3 Chapter 2. Learning Outcomes Identify how to design frames. Explain frames’ attributes. Describe the method on designing forms

Example (Login form)

Page 19: Introduction to HTML Part 3 Chapter 2. Learning Outcomes Identify how to design frames. Explain frames’ attributes. Describe the method on designing forms

Checkboxes

Allows the user to click on a box to toggle a value to either yes or no.

<input type = "checkbox" name=”mailist”

value=”yes” checked>

I’m interested to join the mailing list

Page 20: Introduction to HTML Part 3 Chapter 2. Learning Outcomes Identify how to design frames. Explain frames’ attributes. Describe the method on designing forms

Checkboxes

Sometimes, there will a group of checkboxes. In this case, you will have all there checkboxes

using the same value in the name attribute.

Page 21: Introduction to HTML Part 3 Chapter 2. Learning Outcomes Identify how to design frames. Explain frames’ attributes. Describe the method on designing forms

Grocery Checklist<form action = ""> <input type = "checkbox" name ="groceries" value = "milk" checked> Milk <input type = "checkbox" name ="groceries" value = "bread" > Bread <input type = "checkbox" name = "groceries"

value= "eggs" > Eggs</form>

Checkboxes

Page 22: Introduction to HTML Part 3 Chapter 2. Learning Outcomes Identify how to design frames. Explain frames’ attributes. Describe the method on designing forms

Radio Buttons

Provide mutually exclusive selection value Only one button may be pressed Pressing an alternate button in a radio button

group will automatically remove the previous selection

Page 23: Introduction to HTML Part 3 Chapter 2. Learning Outcomes Identify how to design frames. Explain frames’ attributes. Describe the method on designing forms

Radio Buttons

What Type of Computer do you have?<form action = ""><input type="radio" name="Computer-Type" value="Pentium" checked>Pentium

<input type ="radio" name ="Computer-Type" value ="486DX">486 DX<input type ="radio" name ="Computer-Type“ value ="486SX">486 SX</form>

Page 24: Introduction to HTML Part 3 Chapter 2. Learning Outcomes Identify how to design frames. Explain frames’ attributes. Describe the method on designing forms

Text Area Fields Allows multiple lines of entry to be typed Can be used to capture comments

Page 25: Introduction to HTML Part 3 Chapter 2. Learning Outcomes Identify how to design frames. Explain frames’ attributes. Describe the method on designing forms

Text Area Fields

<p>Comments: <br><form action=“”><textarea name="comments" rows="10" cols="70">This is text that can be defaulted into the text area field</textarea></p>

</form>

Page 26: Introduction to HTML Part 3 Chapter 2. Learning Outcomes Identify how to design frames. Explain frames’ attributes. Describe the method on designing forms

Combo Boxes Provides efficient way to choose a value from a list

of valid values Similar to Radio Buttons