24
Working with Forms and Frames04 Session 4

04. session 04 working withformsandframes

  • Upload
    phuc-do

  • View
    734

  • Download
    1

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: 04. session 04   working withformsandframes

Working with Forms and Frames04

Session 4

Page 2: 04. session 04   working withformsandframes

Module Introduction Frames Forms and Controls

Page 3: 04. session 04   working withformsandframes

FRAMES Explain the FRAMESET element Explain the IFRAME element Explain the NOFRAME element

Page 4: 04. session 04   working withformsandframes

FRAMES

Frames refer to a technique of dividing the browser windows into multiple sub-windows.

Each sub-window is called as a frame. Each frame contains a separate html

page and is independent of other frames in the browser.

Page 5: 04. session 04   working withformsandframes

FRAMESET Elements A frameset specifies a general layout of

a web page that consists of frames. It defines how the browser should be

divided into frames. To specify this division, the FRAMESET

elements provides the ROWS and COLS attributes.

Page 6: 04. session 04   working withformsandframes

FRAMESET Element

<html><head>

<title>Welcome</title></head>

<frameset cols="50%,50%" rows=“*”>

<frame src="First.html"><frame src="Second.html">

</frameset></html>

Page 7: 04. session 04   working withformsandframes

FRAMESET Element

Attribute Description

frameborder Specifies where frames within a frameset consist of borders.

framespacing Specifies the space between individual frames with a framset.

Attribute of Frameset

Page 8: 04. session 04   working withformsandframes

FRAME

Attribute Description

frameborder Specifies whether the current frame consist of borders.

marginheight

Specifies the top and bottom margins of the current frame.

marginwidth Specifies the left and right margins of the current frame.

name Specifies the name of the current frame. The browser use the name to refer to the frame.

noresize Informs that a user cannot resize a current frame

scrolling Specifies scrollbar for the current frame

Attribute of Frame

Page 9: 04. session 04   working withformsandframes

FRAME<html><head>

<title>Welcome</title></head><frameset rows="100,*"> <frame src="Banner.html" frameborder="1"

noresize> <frameset cols="25%,*" frameborder="NO"

noresize> <frame src="Links.html" name="leftFrame"

scrolling="NO" noresize> <frame src="Main.html" name="contents"

frameborder="0"> </frameset></frameset>

<noframes></noframes></html>

Page 10: 04. session 04   working withformsandframes

IFRAME Element Inline frames allow you to embedded an

HTML page within a main HTML page such that the inserted page is displayed as a part of document’s flow.

Inline frames are also called as “floating frames”.

Page 11: 04. session 04   working withformsandframes

IFRAME Element<html><head>

<title>Untitled Document</title></head><body>

<p>This page support iframe.</p><iframe src="AboubtUs.html" width="250" height="100" scrolling="yes" frameborder="1"/><p>This browser does not support IFRAME element.</p>

</body></html>

Page 12: 04. session 04   working withformsandframes

NORAME Element One of the limitations of using frames

is that the frames are not supported by all browser.

The “NOFRAME” element specifies the text to be displayed in the browser if the browser does not support frame<noframes>

<body><p>This browser does not support

frames.</p></body>

</noframes>

Page 13: 04. session 04   working withformsandframes

FORMS AND CONTROLS Explain HTML forms Describe the basic elements Explain the INPUT element Explain the LABEL element Explain the BUTTON element Explain the SELECT and OPTION

elements

Page 14: 04. session 04   working withformsandframes

Forms

An HTML form is a container that consists of various controls such as checkboxes, radio buttons, menus, …

For example, consider a Login form that allows you to specify the login name and password.

Page 15: 04. session 04   working withformsandframes

Forms

Page 16: 04. session 04   working withformsandframes

Forms

Attribute Description

action Specifies the URL where the form data will be submitted and processed.

method Indicates an HTTP method that specifies how the data of the form is send to server.This attribute has two values namely: GET and POST.

Attribute of Form

Page 17: 04. session 04   working withformsandframes

Basic Controls

Label Text Box Button Check Box Radio Button

Page 18: 04. session 04   working withformsandframes

INPUT Element A control allows you to

accept different type of input from the user.

The different values that the type attribute can take care: Text for Text Box Password for Password Submit for the Submit button Reset for the Reset button Radio for Radio Button Checkbox for Check Boxes

Page 19: 04. session 04   working withformsandframes

LABEL Element

A LABEL element creates a label control on a form.

You use the FOR attribute associates a label with another control.

The value of the FOR attribute must be the same as the value of the ID attribute of the associated control element.

Page 20: 04. session 04   working withformsandframes

BUTTON Element

A BUTTON element creates a button on a form.

The buttons created using the BUTTON element are similar to buttons created with INPUT element, however it’s offer richer functionalities.

Page 21: 04. session 04   working withformsandframes

MENU Element

Menus are control that allow the user to select an option from a given set of options.

To create menu, you use SELECT element. The select element must have at least one OPTION element.

Menu that allows the user to select a single option or multiple options.

Page 22: 04. session 04   working withformsandframes

Registration form<html><body><form id="frmReg" name="frmReg" method="post"

action=""> <h2>Account Registration Form</h2> <table width="300"> <tr> <td width="120">Name:</td> <td width="180">

<input name="textfield" type="text" size="25" /> </td> </tr> <tr> <td>Marital Status: </td> <td> <select name="select"> <option>Single</option> <option>Married</option> <option>Married But Available</option> </select>

</td> </tr>

<tr> <td>Address:</td> <td>

<textarea name="textarea" cols="19"></textarea></td>

</tr> <tr> <td></td> <td> <input type="submit" name="Submit"

value="Submit" /> <input type="reset" name="Submit2"

value="Reset" /> </td> </tr> </table></form></body></html>

Page 23: 04. session 04   working withformsandframes

Summary A form is selection of an HTML document

that contains special elements called as controls.

Control are used to accept input from user and provide some interaction

The <FORM> element is used to create the region on the page that will be treated as a form.

The <INPUT> element defines the type and appearance of the control to be displayed on the form

Building Dynamic Websites/Session 1/ 23 of 16

Page 24: 04. session 04   working withformsandframes

Summary… Frames divide a Web broswer’s window into

separate regions, each of which can display separate scrollable page.

An HTML document with frames has a HEAD and a FRAMESET section.

Cannot use BODY and FRAMSET set elements together

The NOFRAMES element is used to specify alternate content to be used if the browser does not support

The IFRAME element is used to define inline frame

Building Dynamic Websites/Session 1/ 24 of 16