Unit 3
Unit 3
UNIT -III
HTML Tables – table creations tags, Nested Tables
Frames: Frame introduction - frame creation tags – Nested Frames – Forms: Form
Controls: textbox, button, password, checkbox, radio button, select, text area -
Processing of forms
HTML Tables
1. TABLES IN HTML:
Table is a collection of rows and columns. Using tables we can
present the data in row wise and column wise. Using tables to provide an information in an
organised way. The following tags are used to create tables in an HTML document.
Table tag
Table row tag
Table data tag
Table heading tag
Caption tag
Table tag:
It is a primary tag. This tag is used to create tables in a webpage.It
is represented as <table>. It is a container tag . It contains following attributes:
Caption tag :
This tag is used to create a small headings for the table. It is
represented as <caption>. It is a container tag.
Syntax: <caption>…………………………………..</caption>
Ex:
<html>
<head></head>
<body>
<h1 align="center"><caption>Student Table</caption></h1>
<table border="4" bordercolor="red" align="center" cellpadding="10"
cellspacing="5" bgcolor="#ff4466">
<tr bgcolor="yellow">
<th>sno</th>
<th>sname</th>
<th>marks</th>
</tr>
<tr>
<td>101</td>
<td> suresh</td>
<td>99</td>
</tr>
<tr>
<td>102</td>
<td>tirupal</td>
<td>100</td>
</tr>
<tr>
<td>103</td>
<td> Gopi</td>
<td>98</td>
</tr>
</table>
</body>
</html>
Output:
Ex:
<html>
<head>
<h1 align="center">Nested Tables</h1></head>
<body>
<table border="4" bordercolor="red" align="center">
<tr>
<td align="center"> First Row</td>
<td>
<table border="8" bordercolor="blue" align="center">
<tr>
<td>First Row</td>
</tr>
<tr>
<td>Second Row</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table border="6" bordercolor="green" align="center">
<tr>
<td>
<ul>
<li>Merit</li>
<li> Dull</li>
<li>Average</li>
</ul>
</td>
</tr>
</table>
</td>
<td>
<table border="8" bordercolor="yellow" align="center">
<tr>
<td> B.Sc & BCA students</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
Output:
Frames
3. Frames in HTML:
A frame allows the programmers to divide the browser window
into multiple sections. Each section acting independently to each other. The
following tags are used to create frames in HTML. They are <frameset> and <frame>.
Frameset tag:
A collection of frames in the browser window is known as Frameset.
This tag determines how the screen will be divided into various frames either
vertically or horizontally. It is a container tag. This tag contains number of attributes.
They are:
Frame tag:
This tag defines the dimensions of the frame. It is a non-container
tag. Each frame is along with a frameset tag. This tag contains number of attributes.
They are:
Syntax:
<frameset rows=“%,%” cols=“%,%” border=“value”
bordercolor=“colorname/coding”
framespacing=“value”>
<frame name=“anyname” src=“url” marginheight=“value”
marginwidth=“value” scrolling=“yes/no”>
<frame name=“anyname” src=“url” marginheight=“value”
marginwidth=“value” scrolling=“yes/no”>
<frame name=“anyname” src=“url” marginheight=“value”
marginwidth=“value” scrolling=“yes/no”>
-------------------
-------------------
--------------------
</frameset>
Example program:
Save as frame.html
<html>
<frameset rows="30%,70%" border="20" bordercolor="red"
framespacing="20">
<frame name="a" src="head.html" border="20" bordercolor="red">
<frameset cols="40%,60%">
<frame name="b" src="link.html" borde="20" bordercolor="green">
<frame name="c" src="matter.html" border="20" bordercolor="pink">
</frameset>
<frameset>
</html>
Save as head.html
<html>
<head></head>
<body>
<h1 align="center">Satya Technologies</h1>
<h2 align="center">Hyderabad</h2>
</body>
</html>
Save as matter.html
<html>
<head></head>
<body>
<h1>It is old Institute in Hyderabad.
It has many computer courses like
c,c++,Java,Python ,Dotnet etc.</h1>
</body>
</html>
Save as link.html
<html>
<head>
</head>
<body>
<a href="fees.html">fees</a><br>
<a href="course.html">course</a>
</body>
</html>
Save as fees.html
<html>
<head></head>
<body>
<b><u> Fees Details:</u></b>
<ul>
<li>5000</li>
<li>6000</li>
</ul>
</body>
</html>
Save as course.html
<html>
<head>
</head>
<body >
<i><u> Courses Offered</i></b><br>
<ul type="circle">
<li>Python</li>
<li> cloud computing</li>
</ul>
</body>
</html>
Output:
Frameset tag:
A collection of frames in the browser window is known as Frameset.
This tag determines how the screen will be divided into various frames either
vertically or horizontally. It is a container tag. This tag contains number of attributes.
They are:
Frame tag:
This tag defines the dimensions of the frame. It is a non-container
tag. Each frame is along with a frameset tag. This tag contains number of attributes.
They are:
Syntax:
<frameset rows=“%,%” cols=“%,%” border=“value”
bordercolor=“colorname/coding”
framespacing=“value”>
<frame name=“anyname” src=“url” marginheight=“value”
marginwidth=“value” scrolling=“yes/no”>
<frame name=“anyname” src=“url” marginheight=“value”
marginwidth=“value” scrolling=“yes/no”>
<frame name=“anyname” src=“url” marginheight=“value”
marginwidth=“value” scrolling=“yes/no”>
-------------------
-------------------
--------------------
</frameset>
Example program:
Save as frames.html:
<html>
<frameset cols="20%,60%,20%" border="4" bordercolor="red"
framespacing="2">
<frameset rows="50%,50%" border="4" bordercolor="green"
framespacing="2">
<frame name="a" src="frame1.html" marginheight="100"
marginwidth="100" scrolling="yes">
<frame name="b" src="frame2.html" marginheight="100"
marginwidth="100" scrolling="yes">
</frameset>
<frame name="c" src="frame3.html" marginheight="200" marginwidth="200"
scrolling="yes">
<frame name="d" src="frame4.html" marginheight="100" marginwidth="100"
scrolling="yes">
</html>
Save as frame1.html:
<html>
<head>
<title> frame1</title>
</head>
<body>
<h1 align="center"> FRAME1</h1>
</body>
</html>
Save as frame2.html:
<html>
<head>
<title> frame2</title>
</head>
<body>
<h1 align="center"> FRAME2</h1>
</body>
</html>
Save as frame3.html:
<html>
<head>
<title>frame3</title>
</head>
<body>
<table border="4" bordercolor="#3388dd" align="center">
<tr>
<td colspan="2" align="center"> frame inside table</td>
</tr>
<tr>
<td>
<ul>
<li>HTML</li>
<li>XML</li>
<li>DHTML</li>
</ul>
</td>
<td>
web related courses
</td>
</tr>
<tr>
<td colspan="2" align="center"> www.w3schools.com</td>
</tr>
</table>
</body>
</html>
Save as frame4.html:
<html>
<head>
<title> frame4</title>
</head>
<body>
<h1 align="center"> FRAME4</h1>
</body>
</html>
Output:
FORM TAG:
This tag contains interface elements such as textbox, password field, radio
buttons, check box, action buttons, combobox and textarea.
INPUT TAG:
This tag defines a form control for the user to enter input. This
tag must be along with in the form tag.
The following attributes are used in input tag:
Type: It specifies the type of the form control
Name: It specifies the name of the form control
Size: It specifies the size of the form control
Value: It specifies the value of the form control
Syntax:
<form>
<input type=“form element type” name=“name” value=“value” size=“size”>
--------------
---------------
----------------
</form>
The form elements are:
Textbox:
It is a rectangular shaped field in which the user can enter the text . The general
form is:
<input type=”textbox” name=”any name” value=”any value” size=”any size”>
Password field:
This element is used to display the invisible characters. The general form is:
<input type=”password” name=”any name” value=”any value” size=”any size”>
Radio buttons:
It is also called as group of buttons, from which only one can be selected at a
time, that means pushing button forced, currently selected or deleted. The general
form is:
<input type=”radio” name=”any name” value=”any value” size=”any size”>
Checkbox:
It is represented by an icon , that the user can select or deselect by clicking on it.
By using checkbox, the user can easily spevify all preferences. The general form is:
< input type=”checkbox” name=”any name” value=”any value” size=”any size”>
Combobox:
This element is used to specify the list of items from the list.The following tags
are used to create the combobox element.They are <select> and <option>. The
general form is:
<select name=”any name” value=”any value” size=”any size”>
<option>...................</option>
<option>....................</option>
......................................
......................................
......................................
</select>.
Textarea:
This element defines the form controls , for the user to enter multiline input
tet. This element contains two special attributes, those are “rows” and “cols”. The
general form is:
<textarea name=”any name” rows=”value” cols=”value”>
</textarea>
NOTE: The form elements combobox and textarea are container tags.
Remaining all form controls are non-container.
Ex:
<html>
<head>
<h1 align="center">Rao's Degree College</h1>
<h2 align="center">Nellore</h2>
</head>
<hr align="center" size="20%" width="30%" color="red">
<body bgcolor="blue">
<form>
<p align="center">
Enter name             <input
type="textbox" name="tb1"><br><br>
Enter Father's name <input type="textbox" name="tb2"><br><br>
Enter password     <input type="password"><br><br>
select gender <input type="radio" name="r1"> Male      
      <input type="radio" name="r2"> Female<br><br>
select hobbies<input type="checkbox" name="cb1"> singing
           
<input type="checkbox" name="cb2" > dancing<br><br>
Select Qualification <select >
<option>ssc</option>
<option>Inter</option>
<option> degree</option>
<option>pg</option>
</select><br><br>
</textarea><br><br>
<input type="submit" value="Submit">        
 
  <input type="reset" value="Reset">
</p>
</form>
</body></html>
Output: