Frames - Forms
Frames - Forms
AND
FORMS
Frames
Doc1.html Doc2.html
Frames.html
Doc1.html Doc2.html
Creating Frames
<html>
<frameset cols = “50%, 50%”>
<frame src=“doc1.html”>
<frame src=“doc2.html”>
</frameset>
</html>
Simple Horizontal Frame
<html>
<frameset rows = “50%, 50%”>
<frame src=“doc1.html”>
<frame src=“doc2.html”>
</frameset>
</html>
<frameset> Attributes
Specifies whether a
0 three-dimensional border
frameborder 1 should be displayed between
frames
Simple Vertical Frame with border
<html>
<frameset cols = “50%, 50%” frameborder=“1”
border=“10” >
<frame src=“doc1.html”>
<frame src=“doc2.html”>
</frameset>
</html>
<frame> Attributes
<html>
<frameset rows = “50%,50%” cols = “50%, 50%”>
<frame src=“frame1.html”>
<frame src=“frame2.html”>
<frame src=“frame3.html”>
<frame src=“frame4.html”>
</frameset>
</html>
Mixed Frame
Example of Mixed Frame - 1
HTML Code for Mixed Frame - 1
<html>
<frameset rows = “60%,40%”>
<frameset cols = “70%,30%”>
<frame src=“frame1.html”>
<frame src=“frame2.html”>
</frameset>
<frame src=“frame3.html”>
</frameset>
</html>
Example of Mixed Frame - 2
HTML Code for Mixed Frame - 2
<html>
<frameset rows = “30%,70%”>
<frame src=“frame1.html”>
<frameset cols = “50%,50%”>
<frame src=“frame2.html”>
<frame src=“frame3.html”>
</frameset>
</frameset>
</html>
Example of Mixed Frame - 3
HTML Code for Mixed Frame - 3
<html>
<frameset rows = “50%,50%”>
<frame src=“frame1.html”>
<frameset cols = “40%,30%,40%”>
<frame src=“frame2.html”>
<frame src=“frame3.html”>
<frame src=“frame4.html”>
</frameset>
</frameset>
</html>
Example of Mixed Frame - 4
HTML Code for Mixed Frame - 4
<html>
<frameset rows = “50%,50%”>
<frameset cols = “50%,50%”>
<frame src=“frame1.html”>
<frame src=“frame5.html”>
</frameset>
<frameset cols=“40%,30%,40%”>
<frame src=“frame2.html”>
<frame src=“frame3.html”>
<frame src=“frame4.html”>
</frameset>
</frameset>
</html>
Nested Framesets
Main Frameset -
<html>
<frameset rows="50%,50%">
<frame src = "frame1.html“>
<frame src = "frame2.html“>
</frameset>
</html>
Use Target of Link for Frameset
Contents of frame2.html -
<html>
<frameset cols = "50%,50%">
<frame src = "frame3.html">
<frame src = "frame4.html">
</frameset>
</html>
Use Target of Link for Frameset
Contents of frame3.html -
<html>
<body>
Contents of Frame3
<a href = "frame1.html" target="_parent">
Go to parent frame </a>
</body>
</html>
• e.g.,
<iframe src=“test.html”>
</iframe>
<html>
<body bgcolor=“orange">
<iframe src="demo.html" width="250"
height="250"></iframe>
</body>
</html>
<html>
<body>
<table>
<tr>
<td>
<iframe frameborder="0" scrolling="no"
width="150" height="198" src=“Image URL"
name="imgbox" >
</iframe>
</td>
Use iframe as Target for Link
<td>
<a href=“ Image URL” target="imgbox" >Text1</a><br>
<a href=" Image URL” target="imgbox" >Text2</a><br>
<a href=" Image URL” target="imgbox" >Text3</a>
</td>
</tr>
</table>
</body>
</html>
HTML Forms
•A form will take input from the site visitor and then
will post it to a back-end application such as ASP
Script or PHP script etc.
HTML Forms
• Syntax –
<html>
<body>
<form>
Form elements …
</form>
</body>
</html>
HTML Form Elements
1. Text Input
2. Radio buttons
3. Checkboxes
4. Select box
5. File Select boxes
6. Clickable buttons
Text Input
•There are three types of text input used with the form
–
<html>
<body >
<form>
Username: <input type=“text”
name=“uname”><br>
Password: <input type=“password”
name=“password”><br>
</form>
</body>
</html>
Multiple-line Text Input
• Syntax –
<html>
<body >
<form>
Address: <br>
<textarea rows=“5” cols=“40”
name=“address”>
Enter House no., street, city, state here…
</textarea>
</form>
</body>
</html>
Attributes of <textarea> tag
Attribute Description
Attribute Description
Attribute Description
<html>
<body >
<form> Select Languages known<br>
<select name=“language”>
<option value=“English”> English </option>
<option value=“French”> French </option>
<option value=“German”> German </option>
<option value=“Japanese”> Japanese </option>
</select>
</form>
</body>
</html>
Attributes of <select> tag
Attribute Description
Attribute Description
<html>
<body>
<form>
<input type=“file” name=“upfile”>
</form>
</body>
</html>
Clickable Buttons
Type Description
<html>
<body>
<form>
<fieldset>
<legend>Personal Information</legend>
First Name : <input type=“text” name=“fname”><br>
Last Name : <input type=“text” name=“lname”><br>
Age : <input type=“text” name=“age”><br>
</fieldset>
</form>
</body>
</html>
Input Types
•type = “date”
- used for input fields that should contain a
date
- shows date picker in the input field
•type = “month”
- allows user to select month and year
- shows date picker in the input field
Input Types
•type = “time”
- allows user to select time
- shows time picker in the input field
•type = “week”
- allows user to select a week and year
- shows date picker in the input field
Input Types
•type = “number”
- allows user to enter numeric value
- restriction can be set on the range of
accepted value
•type = “tel”
- used if input field contains telephone
number
Input Types
•type = “range”
- defines a slider control to enter a number
- default range is 1 to 100
- restrictions can be set to change the range
•type = “email”
- used if input field contains e-mail address
- gets automatically validated when
submitted
Input Types
•type = “url”
- used if input field contains a URL address
- gets automatically validated when
submitted
•type = “color”
- used if input field needs color selection
- shows color picker in the input field
Input Types
•type = “hidden”
- defines a hidden input field
- data in the hidden field can not be seen or
modified by users
Input Restrictions
Attribute Description
Attribute Description
<form>
Enter a date after 2010-01-01:
<input type=“date” name=“mindate”
min = “2010-01-02”><br>
</form>
Step attribute with number
<form>
Enter score here:
<input type=“number” name=“score” step = “2”>
</form>
Pattern attribute
<form>
Enter ADHAR number :
<input type=“text” name=“adharno”
pattern=“[0-9]{12}” >
</form>
Placeholder attribute
<form>
Enter ADHAR number :
<input type=“tel” name=“adharno”
pattern=“[0-9]{4}-[0-9]{4}-[0-9]{4}”
placeholder = “1234-1234-1234” >
</form>
Attributes of <form>
Attribute Description